Socket
Socket
Sign inDemoInstall

@uiw/react-color

Package Overview
Dependencies
Maintainers
2
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uiw/react-color - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

2

dist/color.min.js
/*! For license information please see color.min.js.LICENSE.txt */
!function(e,r){"object"===typeof exports&&"object"===typeof module?module.exports=r(require("react")):"function"===typeof define&&define.amd?define(["react"],r):"object"===typeof exports?exports["@uiw/react-color"]=r(require("react")):e["@uiw/react-color"]=r(e.React)}(self,(e=>(()=>{"use strict";var r={31:(e,r,o)=>{var t=o(787),a=Symbol.for("react.element"),s=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,n=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function d(e,r,o){var t,s={},d=null,c=null;for(t in void 0!==o&&(d=""+o),void 0!==r.key&&(d=""+r.key),void 0!==r.ref&&(c=r.ref),r)l.call(r,t)&&!i.hasOwnProperty(t)&&(s[t]=r[t]);if(e&&e.defaultProps)for(t in r=e.defaultProps)void 0===s[t]&&(s[t]=r[t]);return{$$typeof:a,type:e,key:d,ref:c,props:s,_owner:n.current}}r.jsx=d,r.jsxs=d},310:(e,r,o)=>{e.exports=o(31)},787:r=>{r.exports=e}},o={};function t(e){var a=o[e];if(void 0!==a)return a.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,t),s.exports}t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{function e(){return e=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},e.apply(this,arguments)}t.r(a),t.d(a,{Alpha:()=>oe,BACKGROUND_IMG:()=>ee,Block:()=>Ie,Chrome:()=>Fe,ChromeInputType:()=>Le,Circle:()=>Je,Colorful:()=>Ve,Compact:()=>Ge,EditableInput:()=>we,EditableInputHSLA:()=>Ne,EditableInputRGBA:()=>Re,Github:()=>he,GithubPlacement:()=>ce,Hue:()=>ye,Material:()=>or,Pointer:()=>J,Saturation:()=>fe,ShadeSlider:()=>sr,Sketch:()=>gr,Slider:()=>ir,Swatch:()=>se,Wheel:()=>jr,color:()=>I,equalColorObjects:()=>r,equalColorString:()=>o,equalHex:()=>s,getContrastingColor:()=>n,hexToHsva:()=>N,hexToRgba:()=>A,hslStringToHsla:()=>b,hslStringToHsva:()=>x,hslaStringToHsva:()=>f,hslaToHsl:()=>F,hslaToHsva:()=>v,hsvStringToHsva:()=>j,hsvaStringToHsva:()=>m,hsvaToHex:()=>D,hsvaToHexa:()=>M,hsvaToHslString:()=>p,hsvaToHsla:()=>y,hsvaToHslaString:()=>u,hsvaToHsv:()=>H,hsvaToHsvString:()=>h,hsvaToHsvaString:()=>g,hsvaToRgbString:()=>T,hsvaToRgba:()=>P,hsvaToRgbaString:()=>L,parseHue:()=>w,rgbStringToHsva:()=>R,rgbaStringToHsva:()=>k,rgbaToHex:()=>S,rgbaToHexa:()=>B,rgbaToHsva:()=>c,rgbaToRgb:()=>E,validHex:()=>l});var r=(e,r)=>{if(e===r)return!0;for(var o in e)if(e[o]!==r[o])return!1;return!0},o=(e,r)=>e.replace(/\s/g,"")===r.replace(/\s/g,""),s=(e,o)=>e.toLowerCase()===o.toLowerCase()||r(A(e),A(o)),l=e=>/^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(e),n=e=>{if(!e)return"#ffffff";var r=I(e);return(299*r.rgb.r+587*r.rgb.g+114*r.rgb.b)/1e3>=128?"#000000":"#ffffff"},i=255,d=100,c=e=>{var{r:r,g:o,b:t,a:a}=e,s=Math.max(r,o,t),l=s-Math.min(r,o,t),n=l?s===r?(o-t)/l:s===o?2+(t-r)/l:4+(r-o)/l:0;return{h:60*(n<0?n+6:n),s:s?l/s*d:0,v:s/i*d,a:a}},p=e=>{var{h:r,s:o,l:t}=y(e);return"hsl("+r+", "+Math.round(o)+"%, "+Math.round(t)+"%)"},h=e=>{var{h:r,s:o,v:t}=e;return"hsv("+r+", "+o+"%, "+t+"%)"},g=e=>{var{h:r,s:o,v:t,a:a}=e;return"hsva("+r+", "+o+"%, "+t+"%, "+a+")"},u=e=>{var{h:r,s:o,l:t,a:a}=y(e);return"hsla("+r+", "+o+"%, "+t+"%, "+a+")"},b=e=>{var[r,o,t,a]=(e.match(/\d+/g)||[]).map(Number);return{h:r,s:o,l:t,a:a}},f=e=>{var r=/hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?v({h:w(r[1],r[2]),s:Number(r[3]),l:Number(r[4]),a:void 0===r[5]?1:Number(r[5])/(r[6]?100:1)}):{h:0,s:0,v:0,a:1}},x=f,v=e=>{var{h:r,s:o,l:t,a:a}=e;return{h:r,s:(o*=(t<50?t:d-t)/d)>0?2*o/(t+o)*d:0,v:t+o,a:a}},y=e=>{var{h:r,s:o,v:t,a:a}=e,s=(200-o)*t/d;return{h:r,s:s>0&&s<200?o*t/d/(s<=d?s:200-s)*d:0,l:s/2,a:a}},m=e=>{var r=/hsva?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?{h:w(r[1],r[2]),s:Number(r[3]),v:Number(r[4]),a:void 0===r[5]?1:Number(r[5])/(r[6]?d:1)}:{h:0,s:0,v:0,a:1}},C={grad:.9,turn:360,rad:360/(2*Math.PI)},w=function(e,r){return void 0===r&&(r="deg"),Number(e)*(C[r]||1)},j=m,k=e=>{var r=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?c({r:Number(r[1])/(r[2]?d/i:1),g:Number(r[3])/(r[4]?d/i:1),b:Number(r[5])/(r[6]?d/i:1),a:void 0===r[7]?1:Number(r[7])/(r[8]?d:1)}):{h:0,s:0,v:0,a:1}},R=k,S=e=>{var r,{r:o,g:t,b:a}=e;return"#"+(r=(o<<16|t<<8|a).toString(16),new Array(7-r.length).join("0")+r)},B=e=>{var{r:r,g:o,b:t,a:a}=e,s="number"===typeof a&&(255*a|256).toString(16).slice(1);return""+S({r:r,g:o,b:t,a:a})+(s||"")},N=e=>c(A(e)),A=e=>{var r=e.replace("#","");/^#?/.test(e)&&3===r.length&&(e="#"+r.charAt(0)+r.charAt(0)+r.charAt(1)+r.charAt(1)+r.charAt(2)+r.charAt(2));var o=new RegExp("[A-Za-z0-9]{2}","g"),[t,a,s=0,l]=e.match(o).map((e=>parseInt(e,16)));return{r:t,g:a,b:s,a:l?l/i:1}},P=r=>{var{h:o,s:t,v:a,a:s}=r,l=o/60,n=t/d,c=a/d,p=Math.floor(l)%6,h=l-Math.floor(l),g=i*c*(1-n),u=i*c*(1-n*h),b=i*c*(1-n*(1-h));c*=i;var f={};switch(p){case 0:f.r=c,f.g=b,f.b=g;break;case 1:f.r=u,f.g=c,f.b=g;break;case 2:f.r=g,f.g=c,f.b=b;break;case 3:f.r=g,f.g=u,f.b=c;break;case 4:f.r=b,f.g=g,f.b=c;break;case 5:f.r=c,f.g=g,f.b=u}return f.r=Math.round(f.r),f.g=Math.round(f.g),f.b=Math.round(f.b),e({},f,{a:s})},T=e=>{var{r:r,g:o,b:t}=P(e);return"rgb("+r+", "+o+", "+t+")"},L=e=>{var{r:r,g:o,b:t,a:a}=P(e);return"rgba("+r+", "+o+", "+t+", "+a+")"},E=e=>{var{r:r,g:o,b:t}=e;return{r:r,g:o,b:t}},F=e=>{var{h:r,s:o,l:t}=e;return{h:r,s:o,l:t}},D=e=>S(P(e)),M=e=>B(P(e)),H=e=>{var{h:r,s:o,v:t}=e;return{h:r,s:o,v:t}},I=e=>{var r,o,t,a,s,n,i,d;return"string"===typeof e&&l(e)?(n=N(e),i=e):"string"!==typeof e&&(n=e),n&&(t=H(n),s=y(n),a=P(n),d=B(a),i=D(n),o=F(s),r=E(a)),{rgb:r,hsl:o,hsv:t,rgba:a,hsla:s,hsva:n,hex:i,hexa:d}};function z(e,r){if(null==e)return{};var o,t,a={},s=Object.keys(e);for(t=0;t<s.length;t++)o=s[t],r.indexOf(o)>=0||(a[o]=e[o]);return a}var O=t(787),_=t.n(O);function W(e){var r=(0,O.useRef)(e);return(0,O.useEffect)((()=>{r.current=e})),(0,O.useCallback)(((e,o)=>r.current&&r.current(e,o)),[])}var G=e=>"touches"in e,U=e=>{!G(e)&&e.preventDefault&&e.preventDefault()},X=function(e,r,o){return void 0===r&&(r=0),void 0===o&&(o=1),e>o?o:e<r?r:e},Y=(e,r)=>{var o=e.getBoundingClientRect(),t=G(r)?r.touches[0]:r;return{left:X((t.pageX-(o.left+window.pageXOffset))/o.width),top:X((t.pageY-(o.top+window.pageYOffset))/o.height),width:o.width,height:o.height,x:t.pageX-(o.left+window.pageXOffset),y:t.pageY-(o.top+window.pageYOffset)}},q=t(310),V=["prefixCls","className","onMove","onDown"],Q=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-interactive",className:a,onMove:s,onDown:l}=r,n=z(r,V),i=(0,O.useRef)(null),d=(0,O.useRef)(!1),[c,p]=(0,O.useState)(!1),h=W(s),g=W(l),u=(0,O.useCallback)((e=>{U(e),(G(e)?e.touches.length>0:e.buttons>0)&&i.current?h&&h(Y(i.current,e),e):p(!1)}),[h]),b=(0,O.useCallback)((()=>p(!1)),[]),f=(0,O.useCallback)((e=>{var r=e?window.addEventListener:window.removeEventListener;r(d.current?"touchmove":"mousemove",u),r(d.current?"touchend":"mouseup",b)}),[]);(0,O.useEffect)((()=>(f(c),()=>{c&&f(!1)})),[c,f]);var x=(0,O.useCallback)((e=>{U(e.nativeEvent),(e=>!(d.current&&!G(e))&&(d.current=G(e),!0))(e.nativeEvent)&&(g&&g(Y(i.current,e.nativeEvent),e.nativeEvent),p(!0))}),[g]);return(0,q.jsx)("div",e({},n,{className:[t,a||""].filter(Boolean).join(" "),style:e({},n.style,{touchAction:"none"}),ref:i,tabIndex:0,onMouseDown:x,onTouchStart:x}))}));Q.displayName="Interactive";const Z=Q;var $=["className","prefixCls","left","top","style","fillProps"],J=r=>{var{className:o,prefixCls:t,left:a,top:s,style:l,fillProps:n}=r,i=z(r,$),d=e({},l,{position:"absolute",left:a,top:s}),c=e({width:18,height:18,boxShadow:"var(--alpha-pointer-box-shadow)",borderRadius:"50%",backgroundColor:"var(--alpha-pointer-background-color)"},null==n?void 0:n.style,{transform:a?"translate(-9px, -1px)":"translate(-1px, -9px)"});return(0,q.jsx)("div",e({className:t+"-pointer "+(o||""),style:d},i,{children:(0,q.jsx)("div",e({className:t+"-fill"},n,{style:c}))}))},K=["prefixCls","className","hsva","background","bgProps","innerProps","pointerProps","radius","width","height","direction","style","onChange","pointer"],ee="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==",re=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-alpha",className:a,hsva:s,background:l,bgProps:n={},innerProps:i={},pointerProps:d={},radius:c=0,width:p,height:h=16,direction:g="horizontal",style:b,onChange:f,pointer:x}=r,v=z(r,K),y=r=>{f&&f(e({},s,{a:"horizontal"===g?r.left:r.top}),r)},m=u(Object.assign({},s,{a:1})),C="linear-gradient(to "+("horizontal"===g?"right":"bottom")+", rgba(244, 67, 54, 0) 0%, "+m+" 100%)",w={};"horizontal"===g?w.left=100*s.a+"%":w.top=100*s.a+"%";var j=e({"--alpha-background-color":"#fff","--alpha-pointer-background-color":"rgb(248, 248, 248)","--alpha-pointer-box-shadow":"rgb(0 0 0 / 37%) 0px 1px 4px 0px",borderRadius:c,background:"url("+ee+") left center",backgroundColor:"var(--alpha-background-color)"},b,{position:"relative"},{width:p,height:h}),k=x&&"function"===typeof x?x(e({prefixCls:t},d,w)):(0,q.jsx)(J,e({},d,{prefixCls:t},w));return(0,q.jsxs)("div",e({},v,{className:[t,t+"-"+g,a||""].filter(Boolean).join(" "),style:j,ref:o,children:[(0,q.jsx)("div",e({},n,{style:e({inset:0,position:"absolute",background:l||C,borderRadius:c},n.style)})),(0,q.jsx)(Z,e({},i,{style:e({},i.style,{inset:0,zIndex:1,position:"absolute"}),onMove:y,onDown:y,children:k}))]}))}));re.displayName="Aplha";const oe=re;var te=["prefixCls","className","color","colors","style","rectProps","onChange","addonAfter","addonBefore","rectRender"],ae=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-swatch",className:a,color:s,colors:l=[],style:n,rectProps:i={},onChange:d,addonAfter:c,addonBefore:p,rectRender:h}=r,g=z(r,te),u=e({"--swatch-background-color":"rgb(144, 19, 254)",background:"var(--swatch-background-color)",height:15,width:15,marginRight:5,marginBottom:5,cursor:"pointer",position:"relative",outline:"none",borderRadius:2},i.style),b=(e,r)=>{d&&d(N(e),I(N(e)),r)};return(0,q.jsxs)("div",e({ref:o},g,{className:[t,a||""].filter(Boolean).join(" "),style:e({display:"flex",flexWrap:"wrap",position:"relative"},n),children:[p&&_().isValidElement(p)&&p,l&&Array.isArray(l)&&l.map(((r,o)=>{var t="",a="";"string"===typeof r&&(t=r,a=r),"object"===typeof r&&r.color&&(t=r.title||r.color,a=r.color);var l=s&&s.toLocaleLowerCase()===a.toLocaleLowerCase();if(h)return h({key:o,title:t,color:a,checked:!!l,style:e({},u,{background:a}),onClick:e=>b(a,e)});var n=i.children&&_().isValidElement(i.children)?_().cloneElement(i.children,{color:a,checked:l}):null;return(0,q.jsx)("div",e({tabIndex:0,title:t,onClick:e=>b(a,e)},i,{children:n,style:e({},u,{background:a})}),o)})),c&&_().isValidElement(c)&&c]}))}));ae.displayName="Swatch";const se=ae;function le(r){var{style:o,title:t,checked:a,color:s,onClick:l,rectProps:n}=r,i=(0,O.useRef)(null),d=(0,O.useCallback)((()=>{i.current.style.zIndex="2",i.current.style.outline="#fff solid 2px",i.current.style.boxShadow="rgb(0 0 0 / 25%) 0 0 5px 2px"}),[]),c=(0,O.useCallback)((()=>{a||(i.current.style.zIndex="0",i.current.style.outline="initial",i.current.style.boxShadow="initial")}),[a]);return(0,q.jsx)("div",e({ref:i,title:t},n,{onClick:l,onMouseEnter:d,onMouseLeave:c,style:e({},o,{marginRight:0,marginBottom:0,borderRadius:0,boxSizing:"border-box",height:25,width:25},a?{zIndex:1,outline:"#fff solid 2px",boxShadow:"rgb(0 0 0 / 25%) 0 0 5px 2px"}:{zIndex:0},n.style)}))}var ne=["prefixCls","placement","className","style","color","colors","rectProps","onChange"],ie=["key"],de=["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],ce=function(e){return e.Left="L",e.LeftTop="LT",e.LeftBotton="LB",e.Right="R",e.RightTop="RT",e.RightBotton="RB",e.Top="T",e.TopRight="TR",e.TopLeft="TL",e.Botton="B",e.BottonLeft="BL",e.BottonRight="BR",e}({}),pe=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-github",placement:a=ce.TopRight,className:s,style:n,color:i,colors:d=de,rectProps:c={},onChange:p}=r,h=z(r,ne),g="string"===typeof i&&l(i)?N(i):i,u=i?D(g):"",b=e({"--github-border":"1px solid rgba(0, 0, 0, 0.2)","--github-background-color":"#fff","--github-box-shadow":"rgb(0 0 0 / 15%) 0px 3px 12px","--github-arrow-border-color":"rgba(0, 0, 0, 0.15)",width:200,borderRadius:4,background:"var(--github-background-color)",boxShadow:"var(--github-box-shadow)",border:"var(--github-border)",position:"relative",padding:5},n),f={borderStyle:"solid",position:"absolute"},x=e({},f),v=e({},f);return/^T/.test(a)&&(x.borderWidth="0 8px 8px",x.borderColor="transparent transparent var(--github-arrow-border-color)",v.borderWidth="0 7px 7px",v.borderColor="transparent transparent var(--github-background-color)"),a===ce.TopRight&&(x.top=-8,v.top=-7),a===ce.Top&&(x.top=-8,v.top=-7),a===ce.TopLeft&&(x.top=-8,v.top=-7),/^B/.test(a)&&(x.borderWidth="8px 8px 0",x.borderColor="var(--github-arrow-border-color) transparent transparent",v.borderWidth="7px 7px 0",v.borderColor="var(--github-background-color) transparent transparent",a===ce.BottonRight&&(x.top="100%",v.top="100%"),a===ce.Botton&&(x.top="100%",v.top="100%"),a===ce.BottonLeft&&(x.top="100%",v.top="100%")),/^(B|T)/.test(a)&&(a!==ce.Top&&a!==ce.Botton||(x.left="50%",x.marginLeft=-8,v.left="50%",v.marginLeft=-7),a!==ce.TopRight&&a!==ce.BottonRight||(x.right=10,v.right=11),a!==ce.TopLeft&&a!==ce.BottonLeft||(x.left=7,v.left=8)),/^L/.test(a)&&(x.borderWidth="8px 8px 8px 0",x.borderColor="transparent var(--github-arrow-border-color) transparent transparent",v.borderWidth="7px 7px 7px 0",v.borderColor="transparent var(--github-background-color) transparent transparent",x.left=-8,v.left=-7),/^R/.test(a)&&(x.borderWidth="8px 0 8px 8px",x.borderColor="transparent transparent transparent var(--github-arrow-border-color)",v.borderWidth="7px 0 7px 7px",v.borderColor="transparent transparent transparent var(--github-background-color)",x.right=-8,v.right=-7),/^(L|R)/.test(a)&&(a!==ce.RightTop&&a!==ce.LeftTop||(x.top=5,v.top=6),a!==ce.Left&&a!==ce.Right||(x.top="50%",v.top="50%",x.marginTop=-8,v.marginTop=-7),a!==ce.LeftBotton&&a!==ce.RightBotton||(x.top="100%",v.top="100%",x.marginTop=-21,v.marginTop=-20)),(0,q.jsx)(se,e({ref:o,className:[t,s].filter(Boolean).join(" "),colors:d,color:u,rectRender:r=>{var{key:o}=r,t=z(r,ie);return(0,q.jsx)(le,e({},t,{rectProps:c}),o)}},h,{onChange:e=>p&&p(I(e)),style:b,rectProps:{style:{marginRight:0,marginBottom:0,borderRadius:0,height:25,width:25}},addonBefore:(0,q.jsxs)(O.Fragment,{children:[(0,q.jsx)("div",{style:x}),(0,q.jsx)("div",{style:v})]})}))}));pe.displayName="Github";const he=pe;var ge=e=>{var{className:r,color:o,left:t,top:a,prefixCls:s}=e,l={position:"absolute",top:a,left:t},n={"--saturation-pointer-box-shadow":"rgb(255 255 255) 0px 0px 0px 1.5px, rgb(0 0 0 / 30%) 0px 0px 1px 1px inset, rgb(0 0 0 / 40%) 0px 0px 1px 2px",width:6,height:6,transform:"translate(-3px, -3px)",boxShadow:"var(--saturation-pointer-box-shadow)",borderRadius:"50%",backgroundColor:o};return(0,O.useMemo)((()=>(0,q.jsx)("div",{className:s+"-pointer "+(r||""),style:l,children:(0,q.jsx)("div",{className:s+"-fill",style:n})})),[a,t,o,r,s])},ue=["prefixCls","radius","pointer","className","style","hsva","onChange"],be=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-saturation",radius:a=0,pointer:s,className:l,style:n,hsva:i,onChange:d}=r,c=z(r,ue),p=e({width:200,height:200,borderRadius:a},n,{position:"relative"}),h=(e,r)=>{d&&d({h:i.h,s:100*e.left,v:100*(1-e.top),a:i.a})},g={top:100-i.v+"%",left:i.s+"%",color:u(i)},b=s&&"function"===typeof s?s(e({prefixCls:t},g)):(0,q.jsx)(ge,e({prefixCls:t},g));return(0,q.jsx)(Z,e({className:[t,l||""].filter(Boolean).join(" ")},c,{style:e({position:"absolute",inset:0,cursor:"crosshair",backgroundImage:"linear-gradient(0deg, #000, transparent), linear-gradient(90deg, #fff, hsl("+i.h+", 100%, 50%))"},p),ref:o,onMove:h,onDown:h,children:b}))}));be.displayName="Saturation";const fe=be;var xe=["prefixCls","className","hue","onChange","direction"],ve=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-hue",className:a,hue:s=0,onChange:l,direction:n="horizontal"}=r,i=z(r,xe);return(0,q.jsx)(oe,e({ref:o,className:t+" "+(a||"")},i,{direction:n,background:"linear-gradient(to "+("horizontal"===n?"right":"bottom")+", rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)",hsva:{h:s,s:100,v:100,a:s/360},onChange:(e,r)=>{l&&l({h:"horizontal"===n?360*r.left:360*r.top})}}))}));ve.displayName="Hue";const ye=ve;var me=["prefixCls","placement","label","value","className","style","labelStyle","inputStyle","onChange","onBlur"],Ce=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-editable-input",placement:a="bottom",label:s,value:l,className:n,style:i,labelStyle:d,inputStyle:c,onChange:p,onBlur:h}=r,g=z(r,me),[u,b]=(0,O.useState)(l),f=(0,O.useRef)(!1);(0,O.useEffect)((()=>{r.value!==u&&(f.current||b(r.value))}),[r.value]);var x={};"bottom"===a&&(x.flexDirection="column"),"top"===a&&(x.flexDirection="column-reverse"),"left"===a&&(x.flexDirection="row-reverse");var v=e({"--editable-input-label-color":"rgb(153, 153, 153)","--editable-input-box-shadow":"rgb(204 204 204) 0px 0px 0px 1px inset","--editable-input-color":"#666",position:"relative",alignItems:"center",display:"flex",fontSize:11},x,i),y=e({width:"100%",paddingTop:2,paddingBottom:2,paddingLeft:3,paddingRight:3,fontSize:11,background:"transparent",boxSizing:"border-box",border:"none",color:"var(--editable-input-color)",boxShadow:"var(--editable-input-box-shadow)"},c);return(0,q.jsxs)("div",{className:[t,n||""].filter(Boolean).join(" "),style:v,children:[(0,q.jsx)("input",e({ref:o,value:u,onChange:function(e,r){var o=r||e.target.value;/^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(o)&&p&&p(e,o);var t=(e=>Number(String(e).replace(/%/g,"")))(o);isNaN(t)||p&&p(e,t),b(o)},onBlur:function(e){f.current=!1,b(r.value),h&&h(e)},autoComplete:"off",onFocus:()=>f.current=!0},g,{style:y})),s&&(0,q.jsx)("span",{style:e({color:"var(--editable-input-label-color)",textTransform:"capitalize"},d),children:s})]})}));Ce.displayName="EditableInput";const we=Ce;var je=["prefixCls","hsva","placement","rProps","gProps","bProps","aProps","className","style","onChange"],ke=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-editable-input-rgba",hsva:a,placement:s="bottom",rProps:l={},gProps:n={},bProps:i={},aProps:d={},className:p,style:h,onChange:g}=r,u=z(r,je),b=a?P(a):{};function f(e){var r=Number(e.target.value);r&&r>255&&(e.target.value="255"),r&&r<0&&(e.target.value="0")}var x=(r,o,t)=>{"number"===typeof r&&("a"===o&&(r<0&&(r=0),r>100&&(r=100),g&&g(I(c(e({},b,{a:r/100}))))),r>255&&(r=255,t.target.value="255"),r<0&&(r=0,t.target.value="0"),"r"===o&&g&&g(I(c(e({},b,{r:r})))),"g"===o&&g&&g(I(c(e({},b,{g:r})))),"b"===o&&g&&g(I(c(e({},b,{b:r})))))};return(0,q.jsxs)("div",e({ref:o,className:[t,p||""].filter(Boolean).join(" ")},u,{style:e({fontSize:11,display:"flex"},h),children:[(0,q.jsx)(we,e({label:"R",value:b.r||0,onBlur:f,placement:s,onChange:(e,r)=>x(r,"r",e)},l,{style:e({},l.style)})),(0,q.jsx)(we,e({label:"G",value:b.g||0,onBlur:f,placement:s,onChange:(e,r)=>x(r,"g",e)},n,{style:e({marginLeft:5},l.style)})),(0,q.jsx)(we,e({label:"B",value:b.b||0,onBlur:f,placement:s,onChange:(e,r)=>x(r,"b",e)},i,{style:e({marginLeft:5},i.style)})),d&&(0,q.jsx)(we,e({label:"A",value:b.a?parseInt(String(100*b.a),10):0,onBlur:f,placement:s,onChange:(e,r)=>x(r,"a",e)},d,{style:e({marginLeft:5},d.style)}))]}))}));ke.displayName="EditableInputRGBA";const Re=ke;var Se=["prefixCls","hsva","hProps","sProps","lProps","aProps","className","onChange"],Be=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-editable-input-hsla",hsva:a,hProps:s={},sProps:l={},lProps:n={},aProps:i={},className:d,onChange:c}=r,p=z(r,Se),h=a?y(a):{h:0,s:0,l:0,a:0},g=(r,o,t)=>{"number"===typeof r&&("h"===o&&(r<0&&(r=0),r>360&&(r=360),c&&c(I(v(e({},h,{h:r}))))),"s"===o&&(r<0&&(r=0),r>100&&(r=100),c&&c(I(v(e({},h,{s:r}))))),"l"===o&&(r<0&&(r=0),r>100&&(r=100),c&&c(I(v(e({},h,{l:r}))))),"a"===o&&(r<0&&(r=0),r>1&&(r=1),c&&c(I(v(e({},h,{a:r}))))))};return(0,q.jsx)(Re,e({ref:o,hsva:a,rProps:e({label:"H",value:Math.round(h.h)},s,{onChange:(e,r)=>g(r,"h")}),gProps:e({label:"S",value:Math.round(h.s)+"%"},l,{onChange:(e,r)=>g(r,"s")}),bProps:e({label:"L",value:Math.round(h.l)+"%"},n,{onChange:(e,r)=>g(r,"l")}),aProps:e({label:"A",value:Math.round(100*h.a)/100},i,{onChange:(e,r)=>g(r,"a")}),className:[t,d||""].filter(Boolean).join(" ")},p))}));Be.displayName="EditableInputHSLA";const Ne=Be;var Ae=["style"];function Pe(r){var{style:o}=r,t=z(r,Ae),a=(0,O.useRef)(null),s=(0,O.useCallback)((()=>{a.current.style.backgroundColor="var(--chrome-arrow-background-color)"}),[]),l=(0,O.useCallback)((()=>{a.current.style.backgroundColor="transparent"}),[]);return(0,q.jsx)("div",e({ref:a,style:e({marginLeft:5,cursor:"pointer",transition:"background-color .3s",borderRadius:2},o)},t,{onMouseEnter:s,onMouseLeave:l,children:(0,q.jsx)("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24",style:{display:"block"},children:(0,q.jsx)("path",{d:"M373.888 576h276.224c9.322667 0 14.293333 11.178667 9.173333 18.773333l-1.258666 1.557334-138.112 146.858666a10.709333 10.709333 0 0 1-14.293334 1.365334l-1.536-1.365334-138.112-146.858666c-6.592-6.997333-2.666667-18.645333 5.973334-20.16l1.941333-0.170667h276.224-276.224z m146.026667-295.189333l138.112 146.858666c7.04 7.509333 2.069333 20.330667-7.914667 20.330667H373.888c-9.984 0-14.976-12.821333-7.914667-20.330667l138.112-146.858666a10.730667 10.730667 0 0 1 15.829334 0z",fill:"var(--chrome-arrow-fill)"})})}))}var Te=["prefixCls","className","style","color","inputType","rectProps","onChange"],Le=function(e){return e.HEXA="hexa",e.RGBA="rgba",e.HSLA="hsla",e}({}),Ee=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-chrome",className:a,style:s,color:n,inputType:i=Le.RGBA,rectProps:d={},onChange:c}=r,p=z(r,Te),h="string"===typeof n&&l(n)?N(n):n||{h:0,s:0,l:0,a:0},g=e=>c&&c(I(e)),[u,b]=(0,O.useState)(i),f={paddingTop:6},x={textAlign:"center",paddingTop:4,paddingBottom:4},v=e({"--chrome-arrow-fill":"#333","--chrome-arrow-background-color":"#e8e8e8",borderRadius:0,flexDirection:"column",width:230,padding:0},s),y={"--chrome-alpha-box-shadow":"rgb(0 0 0 / 25%) 0px 0px 1px inset",borderRadius:"50%",background:L(h),boxShadow:"var(--chrome-alpha-box-shadow)"};return(0,q.jsx)(he,e({ref:o,color:h,style:v,colors:void 0,className:[t,a].filter(Boolean).join(" "),placement:ce.TopLeft},p,{addonAfter:(0,q.jsxs)(O.Fragment,{children:[(0,q.jsx)(fe,{hsva:h,style:{width:"100%",height:130},onChange:r=>{g(e({},h,r,{a:h.a}))}}),(0,q.jsxs)("div",{style:{padding:15,display:"flex",alignItems:"center"},children:[(0,q.jsx)(oe,{width:24,height:24,hsva:h,radius:2,style:{marginRight:15,borderRadius:"50%"},bgProps:{style:{background:"transparent"}},innerProps:{style:y},pointer:()=>(0,q.jsx)(O.Fragment,{})}),(0,q.jsxs)("div",{style:{flex:1},children:[(0,q.jsx)(ye,{hue:h.h,style:{width:"100%"},bgProps:{style:{borderRadius:2}},onChange:r=>{g(e({},h,r))}}),(0,q.jsx)(oe,{hsva:h,style:{marginTop:10},bgProps:{style:{borderRadius:2}},onChange:r=>{g(e({},h,r))}})]})]}),(0,q.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",padding:"0 15px 15px 15px",userSelect:"none"},children:[(0,q.jsxs)("div",{style:{flex:1},children:[u==Le.RGBA&&(0,q.jsx)(Re,{hsva:h,rProps:{labelStyle:f,inputStyle:x},gProps:{labelStyle:f,inputStyle:x},bProps:{labelStyle:f,inputStyle:x},aProps:{labelStyle:f,inputStyle:x},onChange:e=>g(e.hsva)}),u===Le.HEXA&&(0,q.jsx)(we,{label:"HEX",labelStyle:f,inputStyle:x,value:h.a>0&&h.a<1?M(h).toLocaleUpperCase():D(h).toLocaleUpperCase(),onChange:(e,r)=>{"string"===typeof r&&g(N(/^#/.test(r)?r:"#"+r))}}),u===Le.HSLA&&(0,q.jsx)(Ne,{hsva:h,hProps:{labelStyle:f,inputStyle:x},sProps:{labelStyle:f,inputStyle:x},lProps:{labelStyle:f,inputStyle:x},aProps:{labelStyle:f,inputStyle:x},onChange:e=>g(e.hsva)})]}),(0,q.jsx)(Pe,{onClick:()=>{u===Le.RGBA&&b(Le.HSLA),u===Le.HSLA&&b(Le.HEXA),u===Le.HEXA&&b(Le.RGBA)}})]})]}),rectRender:e=>{var{key:r}=e;return(0,q.jsx)(O.Fragment,{},r)}}))}));Ee.displayName="Chrome";const Fe=Ee;var De=["prefixCls","className","style","color","colors","onChange"],Me=["#D9E3F0","#F47373","#697689","#37D67A","#2CCCE4","#555555","#dce775","#ff8a65","#ba68c8"],He=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-block",className:a,style:s,color:i,colors:d=Me,onChange:c}=r,p=z(r,De),h="string"===typeof i&&l(i)?N(i):i,g=i?D(h):"",u=(e,r)=>{"string"===typeof e&&l(e)&&/(3|6)/.test(String(e.replace(/^#/,"").length))&&c&&c(I(N(e)))},b=e({"--block-background-color":"rgb(255, 255, 255)","--block-box-shadow":"rgb(0 0 0 / 10%) 0 1px",width:170,borderRadius:6,background:"var(--block-background-color)",boxShadow:"var(--block-box-shadow)",position:"relative"},s);return(0,q.jsxs)("div",e({ref:o,className:[t,a].filter(Boolean).join(" "),style:b},p,{children:[(0,q.jsx)("div",{style:{width:0,height:0,borderStyle:"solid",borderWidth:"0 10px 10px",borderColor:"transparent transparent "+g,position:"absolute",top:-10,left:"50%",marginLeft:-10}}),(0,q.jsx)("div",{title:g,style:{backgroundColor:""+g,color:n(g),height:110,fontSize:18,borderRadius:"6px 6px 0 0",display:"flex",alignItems:"center",justifyContent:"center"},children:g.toLocaleUpperCase()}),(0,q.jsx)(se,{colors:d,color:g,style:{paddingLeft:10,paddingTop:10},rectProps:{style:{marginRight:10,marginBottom:10,borderRadius:4,height:22,width:22}},onChange:e=>{c&&c(I(e))}}),(0,q.jsx)(we,{value:g.toLocaleUpperCase(),onChange:(e,r)=>u(r),onBlur:e=>{var r=e.target.value;e.target.value=r.slice(0,6),u(r.slice(0,6))},inputStyle:{height:22,outline:0,borderRadius:3,padding:"0 7px"},style:{padding:10,paddingTop:0,borderRadius:"0 0 6px 6px"}})]}))}));He.displayName="Block";const Ie=He;var ze=["prefixCls","className","style","onChange","color","colors"],Oe=["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"];function _e(e){return e.checked?(0,q.jsx)("div",{style:{height:5,width:5,borderRadius:"50%",backgroundColor:n(e.color)}}):null}var We=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-compact",className:a,style:s,onChange:n,color:i,colors:d=Oe}=r,c=z(r,ze),p="string"===typeof i&&l(i)?N(i):i,h=i?D(p).replace(/^#/,""):"",g=(0,O.useCallback)((e=>n&&n(I(e))),[]),u={style:{alignItems:"baseline"},inputStyle:{boxShadow:"none",backgroundColor:"transparent",outline:0}},b=e({"--compact-background-color":"#f6f6f6",background:"var(--compact-background-color)",borderRadius:3,display:"flex",width:240,flexWrap:"wrap",paddingTop:5,paddingLeft:5},s);return(0,q.jsxs)("div",e({ref:o,style:b,className:[t,a||""].filter(Boolean).join(" ")},c,{children:[(0,q.jsx)(se,{colors:d,color:i?D(p):void 0,rectProps:{children:(0,q.jsx)(_e,{}),style:{display:"flex",alignItems:"center",justifyContent:"center"}},onChange:e=>g(e)}),(0,q.jsxs)("div",{style:{display:"flex",margin:"0 4px 3px 0"},children:[(0,q.jsx)(we,{onChange:(e,r)=>{var o;"string"===typeof(o=r)&&l(o)&&/(3|6)/.test(String(o.length))&&g(N(o))},labelStyle:{paddingRight:5,marginTop:-1},value:h.toLocaleUpperCase(),label:(0,q.jsx)("div",{style:{width:8,height:8,backgroundColor:"#"+h}}),inputStyle:{outline:"none",boxShadow:"initial",background:"transparent"},style:{flexDirection:"row-reverse",flex:"1 1 0%",minWidth:80}}),(0,q.jsx)(Re,{hsva:p,placement:"left",onChange:e=>g(e.hsva),aProps:!1,rProps:u,gProps:u,bProps:u})]})]}))}));We.displayName="Compact";const Ge=We;var Ue=["style","color"],Xe=["prefixCls","className","onChange","color","style","disableAlpha"],Ye=r=>{var{style:o,color:t}=r,a=z(r,Ue),s=e({"--colorful-pointer-background-color":"#fff","--colorful-pointer-border":"2px solid #fff",height:28,width:28,position:"absolute",transform:"translate(-14px, -4px)",boxShadow:"0 2px 4px rgb(0 0 0 / 20%)",borderRadius:"50%",background:"url("+ee+")",backgroundColor:"var(--colorful-pointer-background-color)",border:"var(--colorful-pointer-border)",zIndex:1},o);return(0,q.jsx)("div",e({},a,{style:s,children:(0,q.jsx)("div",{style:{backgroundColor:t,borderRadius:"50%",height:" 100%",width:"100%"}})}))},qe=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-colorful",className:a,onChange:s,color:n,style:i,disableAlpha:d}=r,c=z(r,Xe),p="string"===typeof n&&l(n)?N(n):n||{},h=e=>s&&s(I(e));return(0,q.jsxs)("div",e({ref:o,style:e({width:200,position:"relative"},i)},c,{className:t+" "+(a||""),children:[(0,q.jsx)(fe,{hsva:p,className:t,radius:"8px 8px 0 0",style:{width:"auto",height:150,minWidth:120,borderBottom:"12px solid #000"},pointer:e=>{var{left:r,top:o,color:t}=e;return(0,q.jsx)(Ye,{style:{left:r,top:o,transform:"translate(-16px, -16px)"},color:D(p)})},onChange:r=>h(e({},p,r))}),(0,q.jsx)(ye,{hue:p.h,height:24,radius:d?"0 0 8px 8px":0,className:t,onChange:r=>h(e({},p,r)),pointer:e=>{var{left:r}=e;return(0,q.jsx)(Ye,{style:{left:r},color:"hsl("+(p.h||0)+"deg 100% 50%)"})}}),!d&&(0,q.jsx)(oe,{hsva:p,height:24,className:t,radius:"0 0 8px 8px",pointer:e=>{var{left:r}=e;return(0,q.jsx)(Ye,{style:{left:r},color:L(p)})},onChange:r=>h(e({},p,r))})]}))}));qe.displayName="Colorful";const Ve=qe;function Qe(r){var{style:o,title:t,checked:a,color:s,onClick:l,rectProps:n}=r,i=(0,O.useRef)(null),d=(0,O.useCallback)((()=>{i.current.style.transform="scale(1.2)"}),[]),c=(0,O.useCallback)((()=>{i.current.style.transform="scale(1)"}),[]),p=e({"--circle-point-background-color":"#fff",height:a?"100%":0,width:a?"100%":0,borderRadius:"50%",backgroundColor:"var(--circle-point-background-color)",boxSizing:"border-box",transition:"height 100ms ease 0s, width 100ms ease 0s"},n.style);return(0,q.jsx)("div",{ref:i,onClick:l,onMouseEnter:d,onMouseLeave:c,title:t,style:e({},o,{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,padding:3,borderRadius:"50%",marginRight:12,marginBottom:12,boxSizing:"border-box",transform:"scale(1)",boxShadow:s+" 0px 0px "+(a?5:0)+"px",transition:"transform 100ms ease 0s, box-shadow 100ms ease 0s"}),children:(0,q.jsx)("div",e({},n,{style:p}))})}var Ze=["prefixCls","className","color","colors","rectProps","onChange"],$e=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-circle",className:a,color:s,colors:n=[],rectProps:i={},onChange:d}=r,c=z(r,Ze),p="string"===typeof s&&l(s)?N(s):s||{},h=s?D(p):"";return(0,q.jsx)(se,e({ref:o,colors:n,color:h},c,{className:[t,a].filter(Boolean).join(" "),rectRender:r=>{var o=e({},(function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(r),r));return(0,q.jsx)(Qe,e({},o,{rectProps:i}))},onChange:e=>{d&&d(I(e))}}))}));$e.displayName="Circle";const Je=$e;var Ke=["prefixCls","className","style","color","onChange"],er={boxShadow:"initial",borderWidth:"0 0 1px 0",borderBottomColor:"var(--material-border-bottom-color)",borderBottomStyle:"solid",height:30,outline:0,fontSize:15,padding:0},rr=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-material",className:a,style:s,color:n,onChange:i}=r,d=z(r,Ke),c="string"===typeof n&&l(n)?N(n):n,p=n?D(c).replace(/^#/,""):"",h=(e,r)=>{"string"===typeof e&&l(e)&&/(3|6)/.test(String(e.length))&&i&&i(I(N(e)))},g=e({"--material-border-bottom-color":"#eee","--material-background-color":"#fff",padding:16,width:98,fontFamily:"Roboto",backgroundColor:"var(--material-background-color)"},s);return(0,q.jsxs)("div",e({ref:o,className:[t,a||""].filter(Boolean).join(" "),style:g},d,{children:[(0,q.jsx)(we,{label:"Hex",value:p.toLocaleUpperCase(),onChange:(e,r)=>h(r),onBlur:e=>{var r=e.target.value;e.target.value=r.slice(0,6),h(r.slice(0,6))},inputStyle:{outline:0,border:0,height:30,fontSize:15,padding:0,boxShadow:"initial",borderWidth:"0 0 2px 0",borderBottomColor:p?"#"+p:"var(--material-border-bottom-color)",borderBottomStyle:"solid",background:"transparent"},style:{flexDirection:"column-reverse",alignItems:"flex-start"}}),(0,q.jsx)(Re,{hsva:c,placement:"top",style:{marginTop:11},rProps:{style:{alignItems:"flex-start"},inputStyle:e({},er)},gProps:{style:{alignItems:"flex-start"},inputStyle:e({},er)},bProps:{style:{alignItems:"flex-start"},inputStyle:e({},er)},aProps:!1,onChange:e=>{return r=e.hsva,void(i&&i(I(r)));var r}})]}))}));rr.displayName="Material";const or=rr;var tr=["prefixCls","className","onChange","direction","hsva"],ar=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-saturation",className:a,onChange:s,direction:l="horizontal",hsva:n}=r,i=z(r,tr),d=u(e({},n,{a:1,v:100}));return(0,q.jsx)(oe,e({ref:o},i,{className:t+" "+(a||""),hsva:{h:n.h,s:n.s,v:n.v,a:1-n.v/100},direction:l,background:"linear-gradient(to "+("horizontal"===l?"right":"bottom")+", "+d+", rgb(0, 0, 0))",onChange:(e,r)=>{s&&s({v:"horizontal"===l?100-100*r.left:100-100*r.top})}}))}));ar.displayName="ShadeSlider";const sr=ar;var lr=["prefixCls","className","style","onChange","color","lightness"],nr=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-slider",className:a,style:s,onChange:n,color:i,lightness:d=[80,65,50,35,20]}=r,c=z(r,lr),h="string"===typeof i&&l(i)?N(i):i||{};return(0,q.jsx)("div",e({ref:o,style:e({display:"flex"},s),className:[t,a||""].filter(Boolean).join(" ")},c,{children:d.map(((r,o)=>{var t="hsl("+y(h).h+", 50%, "+r+"%)",a=t===p(h);return(0,q.jsx)("div",{style:{paddingLeft:1,width:100/d.length+"%",boxSizing:"border-box"},children:(0,q.jsx)("div",{onClick:e=>((e,r)=>{n&&n(I(x(e)),r)})(t,e),style:e({backgroundColor:t,height:12,cursor:"pointer"},a?{borderRadius:2,transform:"scale(1, 1.5)"}:{})})},o)}))}))}));nr.displayName="Slider";const ir=nr;var dr=["prefixCls","className","onChange","width","presetColors","color","editableDisable","disableAlpha","style"],cr=["#D0021B","#F5A623","#f8e61b","#8B572A","#7ED321","#417505","#BD10E0","#9013FE","#4A90E2","#50E3C2","#B8E986","#000000","#4A4A4A","#9B9B9B","#FFFFFF"],pr=e=>(0,q.jsx)("div",{style:{boxShadow:"rgb(0 0 0 / 60%) 0px 0px 2px",width:4,top:1,bottom:1,left:e.left,borderRadius:1,position:"absolute",backgroundColor:"#fff"}}),hr=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-sketch",className:a,onChange:s,width:n=218,presetColors:i=cr,color:d,editableDisable:c=!0,disableAlpha:p=!1,style:h}=r,g=z(r,dr),[u,b]=(0,O.useState)({h:209,s:36,v:90,a:1});(0,O.useEffect)((()=>{"string"===typeof d&&l(d)&&b(N(d)),"object"===typeof d&&b(d)}),[d]);var f=e=>{b(e),s&&s(I(e))},x=e({"--sketch-background":"rgb(255, 255, 255)","--sketch-box-shadow":"rgb(0 0 0 / 15%) 0px 0px 0px 1px, rgb(0 0 0 / 15%) 0px 8px 16px","--sketch-swatch-box-shadow":"rgb(0 0 0 / 15%) 0px 0px 0px 1px inset","--sketch-alpha-box-shadow":"rgb(0 0 0 / 15%) 0px 0px 0px 1px inset, rgb(0 0 0 / 25%) 0px 0px 4px inset","--sketch-swatch-border-top":"1px solid rgb(238, 238, 238)",background:"var(--sketch-background)",borderRadius:4,boxShadow:"var(--sketch-box-shadow)",width:n},h),v={borderRadius:2,background:L(u),boxShadow:"var(--sketch-alpha-box-shadow)"};return(0,q.jsxs)("div",e({},g,{className:t+" "+(a||""),ref:o,style:x,children:[(0,q.jsxs)("div",{style:{padding:"10px 10px 8px"},children:[(0,q.jsx)(fe,{hsva:u,style:{width:"auto",height:150},onChange:r=>f(e({},u,r,{a:u.a}))}),(0,q.jsxs)("div",{style:{display:"flex",marginTop:4},children:[(0,q.jsxs)("div",{style:{flex:1},children:[(0,q.jsx)(ye,{width:"auto",height:10,hue:u.h,pointer:pr,innerProps:{style:{marginLeft:1,marginRight:5}},onChange:r=>f(e({},u,r))}),!p&&(0,q.jsx)(oe,{width:"auto",height:10,hsva:u,pointer:pr,style:{marginTop:4},innerProps:{style:{marginLeft:1,marginRight:5}},onChange:r=>f(e({},u,{a:r.a}))})]}),!p&&(0,q.jsx)(oe,{width:24,height:24,hsva:u,radius:2,style:{marginLeft:4},bgProps:{style:{background:"transparent"}},innerProps:{style:v},pointer:()=>(0,q.jsx)(O.Fragment,{})})]})]}),c&&(0,q.jsxs)("div",{style:{display:"flex",margin:"0 10px 3px 10px"},children:[(0,q.jsx)(we,{label:"Hex",value:D(u).replace(/^#/,"").toLocaleUpperCase(),onChange:(e,r)=>{var o;"string"===typeof(o=r)&&l(o)&&/(3|6)/.test(String(o.length))&&f(N(o))},style:{minWidth:58}}),(0,q.jsx)(Re,{hsva:u,style:{marginLeft:6},aProps:!p&&{},onChange:e=>f(e.hsva)})]}),i&&i.length>0&&(0,q.jsx)(se,{style:{borderTop:"var(--sketch-swatch-border-top)",paddingTop:10,paddingLeft:10},colors:i,color:D(u),onChange:e=>f(e),rectProps:{style:{marginRight:10,marginBottom:10,borderRadius:3,boxShadow:"var(--sketch-swatch-box-shadow)"}}})]}))}));hr.displayName="Sketch";const gr=hr;var ur=r=>{var{className:o,color:t,left:a,top:s,style:l,prefixCls:n}=r,i=e({},l,{position:"absolute",top:s,left:a}),d=n+"-pointer "+(o||"");return(0,q.jsx)("div",{className:d,style:i,children:(0,q.jsx)("div",{className:n+"-fill",style:{width:10,height:10,transform:"translate(-5px, -5px)",boxShadow:"rgb(255 255 255) 0px 0px 0px 1.5px, rgb(0 0 0 / 30%) 0px 0px 1px 1px inset, rgb(0 0 0 / 40%) 0px 0px 1px 2px",borderRadius:"50%",backgroundColor:"#fff"},children:(0,q.jsx)("div",{style:{inset:0,borderRadius:"50%",position:"absolute",backgroundColor:t}})})})},br=2*Math.PI,fr=(e,r)=>(e%r+r)%r,xr=(e,r)=>Math.sqrt(e*e+r*r);function vr(e){var{width:r=0}=e,o=r/2;return{width:r,radius:o,cx:o,cy:o}}function yr(e){var{width:r=0}=e;return r/2}function mr(e,r,o){var t=e.angle||0,a=e.direction;return o&&"clockwise"===a?r=t+r:"clockwise"===a?r=360-t+r:o&&"anticlockwise"===a?r=t+180-r:"anticlockwise"===a&&(r=t-r),fr(r,360)}var Cr=["prefixCls","radius","pointer","className","style","width","height","direction","angle","color","onChange"],wr=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-wheel",radius:a=0,pointer:s,className:n,style:i,width:d=200,height:c=200,direction:p="anticlockwise",angle:h=180,color:g,onChange:u}=r,b=z(r,Cr),f="string"===typeof g&&l(g)?N(g):g||{},x=g?D(f):"",v=function(e,r){var{cx:o,cy:t}=vr(e),a=yr(e),s=(180+mr(e,r.h,!0))*(br/360),l=r.s/100*a,n="clockwise"===e.direction?-1:1;return{x:o+l*Math.cos(s)*n,y:t+l*Math.sin(s)*n}}({width:d},f),y={top:"0",left:"0",color:x},m=(e,r)=>{var o=function(e,r,o){var{cx:t,cy:a}=vr(e),s=yr(e);r=t-r,o=a-o;var l=mr(e,Math.atan2(-o,-r)*(360/br)),n=Math.min(xr(r,o),s);return{h:Math.round(l),s:Math.round(100/s*n)}}({width:d},d-e.x,c-e.y),t={h:o.h,s:o.s,v:f.v,a:f.a};u&&u(I(t))},C={zIndex:1,transform:"translate("+v.x+"px, "+v.y+"px)"},w=s&&"function"===typeof s?s(e({prefixCls:t,style:C},y)):(0,q.jsx)(ur,e({prefixCls:t,style:C},y));return(0,q.jsxs)(Z,e({className:[t,n||""].filter(Boolean).join(" ")},b,{style:e({position:"relative",width:d,height:c},i),ref:o,onMove:m,onDown:m,children:[w,(0,q.jsx)("div",{style:{position:"absolute",borderRadius:"50%",background:"anticlockwise"===p?"conic-gradient(red, yellow, lime, aqua, blue, magenta, red)":"conic-gradient(red, magenta, blue, aqua, lime, yellow, red)",transform:"rotateZ("+(h+90)+"deg)",inset:0}}),(0,q.jsx)("div",{style:{position:"absolute",borderRadius:"50%",background:"radial-gradient(circle closest-side, #fff, transparent)",inset:0}}),(0,q.jsx)("div",{style:{backgroundColor:"#000",borderRadius:"50%",position:"absolute",inset:0,opacity:"number"===typeof f.v?1-f.v/100:0}})]}))}));wr.displayName="Wheel";const jr=wr})(),a})()));
!function(e,r){"object"===typeof exports&&"object"===typeof module?module.exports=r(require("react")):"function"===typeof define&&define.amd?define(["react"],r):"object"===typeof exports?exports["@uiw/react-color"]=r(require("react")):e["@uiw/react-color"]=r(e.React)}(self,(e=>(()=>{"use strict";var r={31:(e,r,o)=>{var t=o(787),a=Symbol.for("react.element"),s=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,n=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function d(e,r,o){var t,s={},d=null,c=null;for(t in void 0!==o&&(d=""+o),void 0!==r.key&&(d=""+r.key),void 0!==r.ref&&(c=r.ref),r)l.call(r,t)&&!i.hasOwnProperty(t)&&(s[t]=r[t]);if(e&&e.defaultProps)for(t in r=e.defaultProps)void 0===s[t]&&(s[t]=r[t]);return{$$typeof:a,type:e,key:d,ref:c,props:s,_owner:n.current}}r.jsx=d,r.jsxs=d},310:(e,r,o)=>{e.exports=o(31)},787:r=>{r.exports=e}},o={};function t(e){var a=o[e];if(void 0!==a)return a.exports;var s=o[e]={exports:{}};return r[e](s,s.exports,t),s.exports}t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{function e(){return e=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},e.apply(this,arguments)}t.r(a),t.d(a,{Alpha:()=>oe,BACKGROUND_IMG:()=>ee,Block:()=>Ie,Chrome:()=>Fe,ChromeInputType:()=>Le,Circle:()=>Je,Colorful:()=>Ve,Compact:()=>Ge,EditableInput:()=>we,EditableInputHSLA:()=>Ne,EditableInputRGBA:()=>Re,Github:()=>he,GithubPlacement:()=>ce,Hue:()=>ye,Material:()=>or,Pointer:()=>J,Saturation:()=>fe,ShadeSlider:()=>sr,Sketch:()=>ur,Slider:()=>ir,Swatch:()=>se,Wheel:()=>jr,color:()=>I,equalColorObjects:()=>r,equalColorString:()=>o,equalHex:()=>s,getContrastingColor:()=>n,hexToHsva:()=>N,hexToRgba:()=>A,hslStringToHsla:()=>b,hslStringToHsva:()=>x,hslaStringToHsva:()=>f,hslaToHsl:()=>F,hslaToHsva:()=>v,hsvStringToHsva:()=>j,hsvaStringToHsva:()=>m,hsvaToHex:()=>D,hsvaToHexa:()=>M,hsvaToHslString:()=>p,hsvaToHsla:()=>y,hsvaToHslaString:()=>g,hsvaToHsv:()=>H,hsvaToHsvString:()=>h,hsvaToHsvaString:()=>u,hsvaToRgbString:()=>T,hsvaToRgba:()=>P,hsvaToRgbaString:()=>L,parseHue:()=>w,rgbStringToHsva:()=>R,rgbaStringToHsva:()=>k,rgbaToHex:()=>S,rgbaToHexa:()=>B,rgbaToHsva:()=>c,rgbaToRgb:()=>E,validHex:()=>l});var r=(e,r)=>{if(e===r)return!0;for(var o in e)if(e[o]!==r[o])return!1;return!0},o=(e,r)=>e.replace(/\s/g,"")===r.replace(/\s/g,""),s=(e,o)=>e.toLowerCase()===o.toLowerCase()||r(A(e),A(o)),l=e=>/^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(e),n=e=>{if(!e)return"#ffffff";var r=I(e);return(299*r.rgb.r+587*r.rgb.g+114*r.rgb.b)/1e3>=128?"#000000":"#ffffff"},i=255,d=100,c=e=>{var{r:r,g:o,b:t,a:a}=e,s=Math.max(r,o,t),l=s-Math.min(r,o,t),n=l?s===r?(o-t)/l:s===o?2+(t-r)/l:4+(r-o)/l:0;return{h:60*(n<0?n+6:n),s:s?l/s*d:0,v:s/i*d,a:a}},p=e=>{var{h:r,s:o,l:t}=y(e);return"hsl("+r+", "+Math.round(o)+"%, "+Math.round(t)+"%)"},h=e=>{var{h:r,s:o,v:t}=e;return"hsv("+r+", "+o+"%, "+t+"%)"},u=e=>{var{h:r,s:o,v:t,a:a}=e;return"hsva("+r+", "+o+"%, "+t+"%, "+a+")"},g=e=>{var{h:r,s:o,l:t,a:a}=y(e);return"hsla("+r+", "+o+"%, "+t+"%, "+a+")"},b=e=>{var[r,o,t,a]=(e.match(/\d+/g)||[]).map(Number);return{h:r,s:o,l:t,a:a}},f=e=>{var r=/hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?v({h:w(r[1],r[2]),s:Number(r[3]),l:Number(r[4]),a:void 0===r[5]?1:Number(r[5])/(r[6]?100:1)}):{h:0,s:0,v:0,a:1}},x=f,v=e=>{var{h:r,s:o,l:t,a:a}=e;return{h:r,s:(o*=(t<50?t:d-t)/d)>0?2*o/(t+o)*d:0,v:t+o,a:a}},y=e=>{var{h:r,s:o,v:t,a:a}=e,s=(200-o)*t/d;return{h:r,s:s>0&&s<200?o*t/d/(s<=d?s:200-s)*d:0,l:s/2,a:a}},m=e=>{var r=/hsva?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?{h:w(r[1],r[2]),s:Number(r[3]),v:Number(r[4]),a:void 0===r[5]?1:Number(r[5])/(r[6]?d:1)}:{h:0,s:0,v:0,a:1}},C={grad:.9,turn:360,rad:360/(2*Math.PI)},w=function(e,r){return void 0===r&&(r="deg"),Number(e)*(C[r]||1)},j=m,k=e=>{var r=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?c({r:Number(r[1])/(r[2]?d/i:1),g:Number(r[3])/(r[4]?d/i:1),b:Number(r[5])/(r[6]?d/i:1),a:void 0===r[7]?1:Number(r[7])/(r[8]?d:1)}):{h:0,s:0,v:0,a:1}},R=k,S=e=>{var r,{r:o,g:t,b:a}=e;return"#"+(r=(o<<16|t<<8|a).toString(16),new Array(7-r.length).join("0")+r)},B=e=>{var{r:r,g:o,b:t,a:a}=e,s="number"===typeof a&&(255*a|256).toString(16).slice(1);return""+S({r:r,g:o,b:t,a:a})+(s||"")},N=e=>c(A(e)),A=e=>{var r=e.replace("#","");/^#?/.test(e)&&3===r.length&&(e="#"+r.charAt(0)+r.charAt(0)+r.charAt(1)+r.charAt(1)+r.charAt(2)+r.charAt(2));var o=new RegExp("[A-Za-z0-9]{2}","g"),[t,a,s=0,l]=e.match(o).map((e=>parseInt(e,16)));return{r:t,g:a,b:s,a:(null!=l?l:255)/i}},P=r=>{var{h:o,s:t,v:a,a:s}=r,l=o/60,n=t/d,c=a/d,p=Math.floor(l)%6,h=l-Math.floor(l),u=i*c*(1-n),g=i*c*(1-n*h),b=i*c*(1-n*(1-h));c*=i;var f={};switch(p){case 0:f.r=c,f.g=b,f.b=u;break;case 1:f.r=g,f.g=c,f.b=u;break;case 2:f.r=u,f.g=c,f.b=b;break;case 3:f.r=u,f.g=g,f.b=c;break;case 4:f.r=b,f.g=u,f.b=c;break;case 5:f.r=c,f.g=u,f.b=g}return f.r=Math.round(f.r),f.g=Math.round(f.g),f.b=Math.round(f.b),e({},f,{a:s})},T=e=>{var{r:r,g:o,b:t}=P(e);return"rgb("+r+", "+o+", "+t+")"},L=e=>{var{r:r,g:o,b:t,a:a}=P(e);return"rgba("+r+", "+o+", "+t+", "+a+")"},E=e=>{var{r:r,g:o,b:t}=e;return{r:r,g:o,b:t}},F=e=>{var{h:r,s:o,l:t}=e;return{h:r,s:o,l:t}},D=e=>S(P(e)),M=e=>B(P(e)),H=e=>{var{h:r,s:o,v:t}=e;return{h:r,s:o,v:t}},I=e=>{var r,o,t,a,s,n,i,d;return"string"===typeof e&&l(e)?(n=N(e),i=e):"string"!==typeof e&&(n=e),n&&(t=H(n),s=y(n),a=P(n),d=B(a),i=D(n),o=F(s),r=E(a)),{rgb:r,hsl:o,hsv:t,rgba:a,hsla:s,hsva:n,hex:i,hexa:d}};function z(e,r){if(null==e)return{};var o,t,a={},s=Object.keys(e);for(t=0;t<s.length;t++)o=s[t],r.indexOf(o)>=0||(a[o]=e[o]);return a}var O=t(787),_=t.n(O);function W(e){var r=(0,O.useRef)(e);return(0,O.useEffect)((()=>{r.current=e})),(0,O.useCallback)(((e,o)=>r.current&&r.current(e,o)),[])}var G=e=>"touches"in e,U=e=>{!G(e)&&e.preventDefault&&e.preventDefault()},X=function(e,r,o){return void 0===r&&(r=0),void 0===o&&(o=1),e>o?o:e<r?r:e},Y=(e,r)=>{var o=e.getBoundingClientRect(),t=G(r)?r.touches[0]:r;return{left:X((t.pageX-(o.left+window.pageXOffset))/o.width),top:X((t.pageY-(o.top+window.pageYOffset))/o.height),width:o.width,height:o.height,x:t.pageX-(o.left+window.pageXOffset),y:t.pageY-(o.top+window.pageYOffset)}},q=t(310),V=["prefixCls","className","onMove","onDown"],Q=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-interactive",className:a,onMove:s,onDown:l}=r,n=z(r,V),i=(0,O.useRef)(null),d=(0,O.useRef)(!1),[c,p]=(0,O.useState)(!1),h=W(s),u=W(l),g=(0,O.useCallback)((e=>{U(e),(G(e)?e.touches.length>0:e.buttons>0)&&i.current?h&&h(Y(i.current,e),e):p(!1)}),[h]),b=(0,O.useCallback)((()=>p(!1)),[]),f=(0,O.useCallback)((e=>{var r=e?window.addEventListener:window.removeEventListener;r(d.current?"touchmove":"mousemove",g),r(d.current?"touchend":"mouseup",b)}),[]);(0,O.useEffect)((()=>(f(c),()=>{c&&f(!1)})),[c,f]);var x=(0,O.useCallback)((e=>{U(e.nativeEvent),(e=>!(d.current&&!G(e))&&(d.current=G(e),!0))(e.nativeEvent)&&(u&&u(Y(i.current,e.nativeEvent),e.nativeEvent),p(!0))}),[u]);return(0,q.jsx)("div",e({},n,{className:[t,a||""].filter(Boolean).join(" "),style:e({},n.style,{touchAction:"none"}),ref:i,tabIndex:0,onMouseDown:x,onTouchStart:x}))}));Q.displayName="Interactive";const Z=Q;var $=["className","prefixCls","left","top","style","fillProps"],J=r=>{var{className:o,prefixCls:t,left:a,top:s,style:l,fillProps:n}=r,i=z(r,$),d=e({},l,{position:"absolute",left:a,top:s}),c=e({width:18,height:18,boxShadow:"var(--alpha-pointer-box-shadow)",borderRadius:"50%",backgroundColor:"var(--alpha-pointer-background-color)"},null==n?void 0:n.style,{transform:a?"translate(-9px, -1px)":"translate(-1px, -9px)"});return(0,q.jsx)("div",e({className:t+"-pointer "+(o||""),style:d},i,{children:(0,q.jsx)("div",e({className:t+"-fill"},n,{style:c}))}))},K=["prefixCls","className","hsva","background","bgProps","innerProps","pointerProps","radius","width","height","direction","style","onChange","pointer"],ee="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==",re=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-alpha",className:a,hsva:s,background:l,bgProps:n={},innerProps:i={},pointerProps:d={},radius:c=0,width:p,height:h=16,direction:u="horizontal",style:b,onChange:f,pointer:x}=r,v=z(r,K),y=r=>{f&&f(e({},s,{a:"horizontal"===u?r.left:r.top}),r)},m=g(Object.assign({},s,{a:1})),C="linear-gradient(to "+("horizontal"===u?"right":"bottom")+", rgba(244, 67, 54, 0) 0%, "+m+" 100%)",w={};"horizontal"===u?w.left=100*s.a+"%":w.top=100*s.a+"%";var j=e({"--alpha-background-color":"#fff","--alpha-pointer-background-color":"rgb(248, 248, 248)","--alpha-pointer-box-shadow":"rgb(0 0 0 / 37%) 0px 1px 4px 0px",borderRadius:c,background:"url("+ee+") left center",backgroundColor:"var(--alpha-background-color)"},b,{position:"relative"},{width:p,height:h}),k=x&&"function"===typeof x?x(e({prefixCls:t},d,w)):(0,q.jsx)(J,e({},d,{prefixCls:t},w));return(0,q.jsxs)("div",e({},v,{className:[t,t+"-"+u,a||""].filter(Boolean).join(" "),style:j,ref:o,children:[(0,q.jsx)("div",e({},n,{style:e({inset:0,position:"absolute",background:l||C,borderRadius:c},n.style)})),(0,q.jsx)(Z,e({},i,{style:e({},i.style,{inset:0,zIndex:1,position:"absolute"}),onMove:y,onDown:y,children:k}))]}))}));re.displayName="Alpha";const oe=re;var te=["prefixCls","className","color","colors","style","rectProps","onChange","addonAfter","addonBefore","rectRender"],ae=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-swatch",className:a,color:s,colors:l=[],style:n,rectProps:i={},onChange:d,addonAfter:c,addonBefore:p,rectRender:h}=r,u=z(r,te),g=e({"--swatch-background-color":"rgb(144, 19, 254)",background:"var(--swatch-background-color)",height:15,width:15,marginRight:5,marginBottom:5,cursor:"pointer",position:"relative",outline:"none",borderRadius:2},i.style),b=(e,r)=>{d&&d(N(e),I(N(e)),r)};return(0,q.jsxs)("div",e({ref:o},u,{className:[t,a||""].filter(Boolean).join(" "),style:e({display:"flex",flexWrap:"wrap",position:"relative"},n),children:[p&&_().isValidElement(p)&&p,l&&Array.isArray(l)&&l.map(((r,o)=>{var t="",a="";"string"===typeof r&&(t=r,a=r),"object"===typeof r&&r.color&&(t=r.title||r.color,a=r.color);var l=s&&s.toLocaleLowerCase()===a.toLocaleLowerCase();if(h)return h({key:o,title:t,color:a,checked:!!l,style:e({},g,{background:a}),onClick:e=>b(a,e)});var n=i.children&&_().isValidElement(i.children)?_().cloneElement(i.children,{color:a,checked:l}):null;return(0,q.jsx)("div",e({tabIndex:0,title:t,onClick:e=>b(a,e)},i,{children:n,style:e({},g,{background:a})}),o)})),c&&_().isValidElement(c)&&c]}))}));ae.displayName="Swatch";const se=ae;function le(r){var{style:o,title:t,checked:a,color:s,onClick:l,rectProps:n}=r,i=(0,O.useRef)(null),d=(0,O.useCallback)((()=>{i.current.style.zIndex="2",i.current.style.outline="#fff solid 2px",i.current.style.boxShadow="rgb(0 0 0 / 25%) 0 0 5px 2px"}),[]),c=(0,O.useCallback)((()=>{a||(i.current.style.zIndex="0",i.current.style.outline="initial",i.current.style.boxShadow="initial")}),[a]);return(0,q.jsx)("div",e({ref:i,title:t},n,{onClick:l,onMouseEnter:d,onMouseLeave:c,style:e({},o,{marginRight:0,marginBottom:0,borderRadius:0,boxSizing:"border-box",height:25,width:25},a?{zIndex:1,outline:"#fff solid 2px",boxShadow:"rgb(0 0 0 / 25%) 0 0 5px 2px"}:{zIndex:0},n.style)}))}var ne=["prefixCls","placement","className","style","color","colors","rectProps","onChange"],ie=["key"],de=["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],ce=function(e){return e.Left="L",e.LeftTop="LT",e.LeftBotton="LB",e.Right="R",e.RightTop="RT",e.RightBotton="RB",e.Top="T",e.TopRight="TR",e.TopLeft="TL",e.Botton="B",e.BottonLeft="BL",e.BottonRight="BR",e}({}),pe=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-github",placement:a=ce.TopRight,className:s,style:n,color:i,colors:d=de,rectProps:c={},onChange:p}=r,h=z(r,ne),u="string"===typeof i&&l(i)?N(i):i,g=i?D(u):"",b=e({"--github-border":"1px solid rgba(0, 0, 0, 0.2)","--github-background-color":"#fff","--github-box-shadow":"rgb(0 0 0 / 15%) 0px 3px 12px","--github-arrow-border-color":"rgba(0, 0, 0, 0.15)",width:200,borderRadius:4,background:"var(--github-background-color)",boxShadow:"var(--github-box-shadow)",border:"var(--github-border)",position:"relative",padding:5},n),f={borderStyle:"solid",position:"absolute"},x=e({},f),v=e({},f);return/^T/.test(a)&&(x.borderWidth="0 8px 8px",x.borderColor="transparent transparent var(--github-arrow-border-color)",v.borderWidth="0 7px 7px",v.borderColor="transparent transparent var(--github-background-color)"),a===ce.TopRight&&(x.top=-8,v.top=-7),a===ce.Top&&(x.top=-8,v.top=-7),a===ce.TopLeft&&(x.top=-8,v.top=-7),/^B/.test(a)&&(x.borderWidth="8px 8px 0",x.borderColor="var(--github-arrow-border-color) transparent transparent",v.borderWidth="7px 7px 0",v.borderColor="var(--github-background-color) transparent transparent",a===ce.BottonRight&&(x.top="100%",v.top="100%"),a===ce.Botton&&(x.top="100%",v.top="100%"),a===ce.BottonLeft&&(x.top="100%",v.top="100%")),/^(B|T)/.test(a)&&(a!==ce.Top&&a!==ce.Botton||(x.left="50%",x.marginLeft=-8,v.left="50%",v.marginLeft=-7),a!==ce.TopRight&&a!==ce.BottonRight||(x.right=10,v.right=11),a!==ce.TopLeft&&a!==ce.BottonLeft||(x.left=7,v.left=8)),/^L/.test(a)&&(x.borderWidth="8px 8px 8px 0",x.borderColor="transparent var(--github-arrow-border-color) transparent transparent",v.borderWidth="7px 7px 7px 0",v.borderColor="transparent var(--github-background-color) transparent transparent",x.left=-8,v.left=-7),/^R/.test(a)&&(x.borderWidth="8px 0 8px 8px",x.borderColor="transparent transparent transparent var(--github-arrow-border-color)",v.borderWidth="7px 0 7px 7px",v.borderColor="transparent transparent transparent var(--github-background-color)",x.right=-8,v.right=-7),/^(L|R)/.test(a)&&(a!==ce.RightTop&&a!==ce.LeftTop||(x.top=5,v.top=6),a!==ce.Left&&a!==ce.Right||(x.top="50%",v.top="50%",x.marginTop=-8,v.marginTop=-7),a!==ce.LeftBotton&&a!==ce.RightBotton||(x.top="100%",v.top="100%",x.marginTop=-21,v.marginTop=-20)),(0,q.jsx)(se,e({ref:o,className:[t,s].filter(Boolean).join(" "),colors:d,color:g,rectRender:r=>{var{key:o}=r,t=z(r,ie);return(0,q.jsx)(le,e({},t,{rectProps:c}),o)}},h,{onChange:e=>p&&p(I(e)),style:b,rectProps:{style:{marginRight:0,marginBottom:0,borderRadius:0,height:25,width:25}},addonBefore:(0,q.jsxs)(O.Fragment,{children:[(0,q.jsx)("div",{style:x}),(0,q.jsx)("div",{style:v})]})}))}));pe.displayName="Github";const he=pe;var ue=e=>{var{className:r,color:o,left:t,top:a,prefixCls:s}=e,l={position:"absolute",top:a,left:t},n={"--saturation-pointer-box-shadow":"rgb(255 255 255) 0px 0px 0px 1.5px, rgb(0 0 0 / 30%) 0px 0px 1px 1px inset, rgb(0 0 0 / 40%) 0px 0px 1px 2px",width:6,height:6,transform:"translate(-3px, -3px)",boxShadow:"var(--saturation-pointer-box-shadow)",borderRadius:"50%",backgroundColor:o};return(0,O.useMemo)((()=>(0,q.jsx)("div",{className:s+"-pointer "+(r||""),style:l,children:(0,q.jsx)("div",{className:s+"-fill",style:n})})),[a,t,o,r,s])},ge=["prefixCls","radius","pointer","className","style","hsva","onChange"],be=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-saturation",radius:a=0,pointer:s,className:l,style:n,hsva:i,onChange:d}=r,c=z(r,ge),p=e({width:200,height:200,borderRadius:a},n,{position:"relative"}),h=(e,r)=>{d&&d({h:i.h,s:100*e.left,v:100*(1-e.top),a:i.a})},u={top:100-i.v+"%",left:i.s+"%",color:g(i)},b=s&&"function"===typeof s?s(e({prefixCls:t},u)):(0,q.jsx)(ue,e({prefixCls:t},u));return(0,q.jsx)(Z,e({className:[t,l||""].filter(Boolean).join(" ")},c,{style:e({position:"absolute",inset:0,cursor:"crosshair",backgroundImage:"linear-gradient(0deg, #000, transparent), linear-gradient(90deg, #fff, hsl("+i.h+", 100%, 50%))"},p),ref:o,onMove:h,onDown:h,children:b}))}));be.displayName="Saturation";const fe=be;var xe=["prefixCls","className","hue","onChange","direction"],ve=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-hue",className:a,hue:s=0,onChange:l,direction:n="horizontal"}=r,i=z(r,xe);return(0,q.jsx)(oe,e({ref:o,className:t+" "+(a||"")},i,{direction:n,background:"linear-gradient(to "+("horizontal"===n?"right":"bottom")+", rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)",hsva:{h:s,s:100,v:100,a:s/360},onChange:(e,r)=>{l&&l({h:"horizontal"===n?360*r.left:360*r.top})}}))}));ve.displayName="Hue";const ye=ve;var me=["prefixCls","placement","label","value","className","style","labelStyle","inputStyle","onChange","onBlur"],Ce=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-editable-input",placement:a="bottom",label:s,value:l,className:n,style:i,labelStyle:d,inputStyle:c,onChange:p,onBlur:h}=r,u=z(r,me),[g,b]=(0,O.useState)(l),f=(0,O.useRef)(!1);(0,O.useEffect)((()=>{r.value!==g&&(f.current||b(r.value))}),[r.value]);var x={};"bottom"===a&&(x.flexDirection="column"),"top"===a&&(x.flexDirection="column-reverse"),"left"===a&&(x.flexDirection="row-reverse");var v=e({"--editable-input-label-color":"rgb(153, 153, 153)","--editable-input-box-shadow":"rgb(204 204 204) 0px 0px 0px 1px inset","--editable-input-color":"#666",position:"relative",alignItems:"center",display:"flex",fontSize:11},x,i),y=e({width:"100%",paddingTop:2,paddingBottom:2,paddingLeft:3,paddingRight:3,fontSize:11,background:"transparent",boxSizing:"border-box",border:"none",color:"var(--editable-input-color)",boxShadow:"var(--editable-input-box-shadow)"},c);return(0,q.jsxs)("div",{className:[t,n||""].filter(Boolean).join(" "),style:v,children:[(0,q.jsx)("input",e({ref:o,value:g,onChange:function(e,r){var o=r||e.target.value;/^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(o)&&p&&p(e,o);var t=(e=>Number(String(e).replace(/%/g,"")))(o);isNaN(t)||p&&p(e,t),b(o)},onBlur:function(e){f.current=!1,b(r.value),h&&h(e)},autoComplete:"off",onFocus:()=>f.current=!0},u,{style:y})),s&&(0,q.jsx)("span",{style:e({color:"var(--editable-input-label-color)",textTransform:"capitalize"},d),children:s})]})}));Ce.displayName="EditableInput";const we=Ce;var je=["prefixCls","hsva","placement","rProps","gProps","bProps","aProps","className","style","onChange"],ke=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-editable-input-rgba",hsva:a,placement:s="bottom",rProps:l={},gProps:n={},bProps:i={},aProps:d={},className:p,style:h,onChange:u}=r,g=z(r,je),b=a?P(a):{};function f(e){var r=Number(e.target.value);r&&r>255&&(e.target.value="255"),r&&r<0&&(e.target.value="0")}var x=(r,o,t)=>{"number"===typeof r&&("a"===o&&(r<0&&(r=0),r>100&&(r=100),u&&u(I(c(e({},b,{a:r/100}))))),r>255&&(r=255,t.target.value="255"),r<0&&(r=0,t.target.value="0"),"r"===o&&u&&u(I(c(e({},b,{r:r})))),"g"===o&&u&&u(I(c(e({},b,{g:r})))),"b"===o&&u&&u(I(c(e({},b,{b:r})))))};return(0,q.jsxs)("div",e({ref:o,className:[t,p||""].filter(Boolean).join(" ")},g,{style:e({fontSize:11,display:"flex"},h),children:[(0,q.jsx)(we,e({label:"R",value:b.r||0,onBlur:f,placement:s,onChange:(e,r)=>x(r,"r",e)},l,{style:e({},l.style)})),(0,q.jsx)(we,e({label:"G",value:b.g||0,onBlur:f,placement:s,onChange:(e,r)=>x(r,"g",e)},n,{style:e({marginLeft:5},l.style)})),(0,q.jsx)(we,e({label:"B",value:b.b||0,onBlur:f,placement:s,onChange:(e,r)=>x(r,"b",e)},i,{style:e({marginLeft:5},i.style)})),d&&(0,q.jsx)(we,e({label:"A",value:b.a?parseInt(String(100*b.a),10):0,onBlur:f,placement:s,onChange:(e,r)=>x(r,"a",e)},d,{style:e({marginLeft:5},d.style)}))]}))}));ke.displayName="EditableInputRGBA";const Re=ke;var Se=["prefixCls","hsva","hProps","sProps","lProps","aProps","className","onChange"],Be=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-editable-input-hsla",hsva:a,hProps:s={},sProps:l={},lProps:n={},aProps:i={},className:d,onChange:c}=r,p=z(r,Se),h=a?y(a):{h:0,s:0,l:0,a:0},u=(r,o,t)=>{"number"===typeof r&&("h"===o&&(r<0&&(r=0),r>360&&(r=360),c&&c(I(v(e({},h,{h:r}))))),"s"===o&&(r<0&&(r=0),r>100&&(r=100),c&&c(I(v(e({},h,{s:r}))))),"l"===o&&(r<0&&(r=0),r>100&&(r=100),c&&c(I(v(e({},h,{l:r}))))),"a"===o&&(r<0&&(r=0),r>1&&(r=1),c&&c(I(v(e({},h,{a:r}))))))};return(0,q.jsx)(Re,e({ref:o,hsva:a,rProps:e({label:"H",value:Math.round(h.h)},s,{onChange:(e,r)=>u(r,"h")}),gProps:e({label:"S",value:Math.round(h.s)+"%"},l,{onChange:(e,r)=>u(r,"s")}),bProps:e({label:"L",value:Math.round(h.l)+"%"},n,{onChange:(e,r)=>u(r,"l")}),aProps:e({label:"A",value:Math.round(100*h.a)/100},i,{onChange:(e,r)=>u(r,"a")}),className:[t,d||""].filter(Boolean).join(" ")},p))}));Be.displayName="EditableInputHSLA";const Ne=Be;var Ae=["style"];function Pe(r){var{style:o}=r,t=z(r,Ae),a=(0,O.useRef)(null),s=(0,O.useCallback)((()=>{a.current.style.backgroundColor="var(--chrome-arrow-background-color)"}),[]),l=(0,O.useCallback)((()=>{a.current.style.backgroundColor="transparent"}),[]);return(0,q.jsx)("div",e({ref:a,style:e({marginLeft:5,cursor:"pointer",transition:"background-color .3s",borderRadius:2},o)},t,{onMouseEnter:s,onMouseLeave:l,children:(0,q.jsx)("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24",style:{display:"block"},children:(0,q.jsx)("path",{d:"M373.888 576h276.224c9.322667 0 14.293333 11.178667 9.173333 18.773333l-1.258666 1.557334-138.112 146.858666a10.709333 10.709333 0 0 1-14.293334 1.365334l-1.536-1.365334-138.112-146.858666c-6.592-6.997333-2.666667-18.645333 5.973334-20.16l1.941333-0.170667h276.224-276.224z m146.026667-295.189333l138.112 146.858666c7.04 7.509333 2.069333 20.330667-7.914667 20.330667H373.888c-9.984 0-14.976-12.821333-7.914667-20.330667l138.112-146.858666a10.730667 10.730667 0 0 1 15.829334 0z",fill:"var(--chrome-arrow-fill)"})})}))}var Te=["prefixCls","className","style","color","inputType","rectProps","onChange"],Le=function(e){return e.HEXA="hexa",e.RGBA="rgba",e.HSLA="hsla",e}({}),Ee=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-chrome",className:a,style:s,color:n,inputType:i=Le.RGBA,rectProps:d={},onChange:c}=r,p=z(r,Te),h="string"===typeof n&&l(n)?N(n):n||{h:0,s:0,l:0,a:0},u=e=>c&&c(I(e)),[g,b]=(0,O.useState)(i),f={paddingTop:6},x={textAlign:"center",paddingTop:4,paddingBottom:4},v=e({"--chrome-arrow-fill":"#333","--chrome-arrow-background-color":"#e8e8e8",borderRadius:0,flexDirection:"column",width:230,padding:0},s),y={"--chrome-alpha-box-shadow":"rgb(0 0 0 / 25%) 0px 0px 1px inset",borderRadius:"50%",background:L(h),boxShadow:"var(--chrome-alpha-box-shadow)"};return(0,q.jsx)(he,e({ref:o,color:h,style:v,colors:void 0,className:[t,a].filter(Boolean).join(" "),placement:ce.TopLeft},p,{addonAfter:(0,q.jsxs)(O.Fragment,{children:[(0,q.jsx)(fe,{hsva:h,style:{width:"100%",height:130},onChange:r=>{u(e({},h,r,{a:h.a}))}}),(0,q.jsxs)("div",{style:{padding:15,display:"flex",alignItems:"center"},children:[(0,q.jsx)(oe,{width:24,height:24,hsva:h,radius:2,style:{marginRight:15,borderRadius:"50%"},bgProps:{style:{background:"transparent"}},innerProps:{style:y},pointer:()=>(0,q.jsx)(O.Fragment,{})}),(0,q.jsxs)("div",{style:{flex:1},children:[(0,q.jsx)(ye,{hue:h.h,style:{width:"100%"},bgProps:{style:{borderRadius:2}},onChange:r=>{u(e({},h,r))}}),(0,q.jsx)(oe,{hsva:h,style:{marginTop:10},bgProps:{style:{borderRadius:2}},onChange:r=>{u(e({},h,r))}})]})]}),(0,q.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",padding:"0 15px 15px 15px",userSelect:"none"},children:[(0,q.jsxs)("div",{style:{flex:1},children:[g==Le.RGBA&&(0,q.jsx)(Re,{hsva:h,rProps:{labelStyle:f,inputStyle:x},gProps:{labelStyle:f,inputStyle:x},bProps:{labelStyle:f,inputStyle:x},aProps:{labelStyle:f,inputStyle:x},onChange:e=>u(e.hsva)}),g===Le.HEXA&&(0,q.jsx)(we,{label:"HEX",labelStyle:f,inputStyle:x,value:h.a>0&&h.a<1?M(h).toLocaleUpperCase():D(h).toLocaleUpperCase(),onChange:(e,r)=>{"string"===typeof r&&u(N(/^#/.test(r)?r:"#"+r))}}),g===Le.HSLA&&(0,q.jsx)(Ne,{hsva:h,hProps:{labelStyle:f,inputStyle:x},sProps:{labelStyle:f,inputStyle:x},lProps:{labelStyle:f,inputStyle:x},aProps:{labelStyle:f,inputStyle:x},onChange:e=>u(e.hsva)})]}),(0,q.jsx)(Pe,{onClick:()=>{g===Le.RGBA&&b(Le.HSLA),g===Le.HSLA&&b(Le.HEXA),g===Le.HEXA&&b(Le.RGBA)}})]})]}),rectRender:e=>{var{key:r}=e;return(0,q.jsx)(O.Fragment,{},r)}}))}));Ee.displayName="Chrome";const Fe=Ee;var De=["prefixCls","className","style","color","colors","onChange"],Me=["#D9E3F0","#F47373","#697689","#37D67A","#2CCCE4","#555555","#dce775","#ff8a65","#ba68c8"],He=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-block",className:a,style:s,color:i,colors:d=Me,onChange:c}=r,p=z(r,De),h="string"===typeof i&&l(i)?N(i):i,u=i?D(h):"",g=(e,r)=>{"string"===typeof e&&l(e)&&/(3|6)/.test(String(e.replace(/^#/,"").length))&&c&&c(I(N(e)))},b=e({"--block-background-color":"rgb(255, 255, 255)","--block-box-shadow":"rgb(0 0 0 / 10%) 0 1px",width:170,borderRadius:6,background:"var(--block-background-color)",boxShadow:"var(--block-box-shadow)",position:"relative"},s);return(0,q.jsxs)("div",e({ref:o,className:[t,a].filter(Boolean).join(" "),style:b},p,{children:[(0,q.jsx)("div",{style:{width:0,height:0,borderStyle:"solid",borderWidth:"0 10px 10px",borderColor:"transparent transparent "+u,position:"absolute",top:-10,left:"50%",marginLeft:-10}}),(0,q.jsx)("div",{title:u,style:{backgroundColor:""+u,color:n(u),height:110,fontSize:18,borderRadius:"6px 6px 0 0",display:"flex",alignItems:"center",justifyContent:"center"},children:u.toLocaleUpperCase()}),(0,q.jsx)(se,{colors:d,color:u,style:{paddingLeft:10,paddingTop:10},rectProps:{style:{marginRight:10,marginBottom:10,borderRadius:4,height:22,width:22}},onChange:e=>{c&&c(I(e))}}),(0,q.jsx)(we,{value:u.toLocaleUpperCase(),onChange:(e,r)=>g(r),onBlur:e=>{var r=e.target.value;e.target.value=r.slice(0,6),g(r.slice(0,6))},inputStyle:{height:22,outline:0,borderRadius:3,padding:"0 7px"},style:{padding:10,paddingTop:0,borderRadius:"0 0 6px 6px"}})]}))}));He.displayName="Block";const Ie=He;var ze=["prefixCls","className","style","onChange","color","colors"],Oe=["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"];function _e(e){return e.checked?(0,q.jsx)("div",{style:{height:5,width:5,borderRadius:"50%",backgroundColor:n(e.color)}}):null}var We=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-compact",className:a,style:s,onChange:n,color:i,colors:d=Oe}=r,c=z(r,ze),p="string"===typeof i&&l(i)?N(i):i,h=i?D(p).replace(/^#/,""):"",u=(0,O.useCallback)((e=>n&&n(I(e))),[]),g={style:{alignItems:"baseline"},inputStyle:{boxShadow:"none",backgroundColor:"transparent",outline:0}},b=e({"--compact-background-color":"#f6f6f6",background:"var(--compact-background-color)",borderRadius:3,display:"flex",width:240,flexWrap:"wrap",paddingTop:5,paddingLeft:5},s);return(0,q.jsxs)("div",e({ref:o,style:b,className:[t,a||""].filter(Boolean).join(" ")},c,{children:[(0,q.jsx)(se,{colors:d,color:i?D(p):void 0,rectProps:{children:(0,q.jsx)(_e,{}),style:{display:"flex",alignItems:"center",justifyContent:"center"}},onChange:e=>u(e)}),(0,q.jsxs)("div",{style:{display:"flex",margin:"0 4px 3px 0"},children:[(0,q.jsx)(we,{onChange:(e,r)=>{var o;"string"===typeof(o=r)&&l(o)&&/(3|6)/.test(String(o.length))&&u(N(o))},labelStyle:{paddingRight:5,marginTop:-1},value:h.toLocaleUpperCase(),label:(0,q.jsx)("div",{style:{width:8,height:8,backgroundColor:"#"+h}}),inputStyle:{outline:"none",boxShadow:"initial",background:"transparent"},style:{flexDirection:"row-reverse",flex:"1 1 0%",minWidth:80}}),(0,q.jsx)(Re,{hsva:p,placement:"left",onChange:e=>u(e.hsva),aProps:!1,rProps:g,gProps:g,bProps:g})]})]}))}));We.displayName="Compact";const Ge=We;var Ue=["style","color"],Xe=["prefixCls","className","onChange","color","style","disableAlpha"],Ye=r=>{var{style:o,color:t}=r,a=z(r,Ue),s=e({"--colorful-pointer-background-color":"#fff","--colorful-pointer-border":"2px solid #fff",height:28,width:28,position:"absolute",transform:"translate(-14px, -4px)",boxShadow:"0 2px 4px rgb(0 0 0 / 20%)",borderRadius:"50%",background:"url("+ee+")",backgroundColor:"var(--colorful-pointer-background-color)",border:"var(--colorful-pointer-border)",zIndex:1},o);return(0,q.jsx)("div",e({},a,{style:s,children:(0,q.jsx)("div",{style:{backgroundColor:t,borderRadius:"50%",height:" 100%",width:"100%"}})}))},qe=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-colorful",className:a,onChange:s,color:n,style:i,disableAlpha:d}=r,c=z(r,Xe),p="string"===typeof n&&l(n)?N(n):n||{},h=e=>s&&s(I(e));return(0,q.jsxs)("div",e({ref:o,style:e({width:200,position:"relative"},i)},c,{className:t+" "+(a||""),children:[(0,q.jsx)(fe,{hsva:p,className:t,radius:"8px 8px 0 0",style:{width:"auto",height:150,minWidth:120,borderBottom:"12px solid #000"},pointer:e=>{var{left:r,top:o,color:t}=e;return(0,q.jsx)(Ye,{style:{left:r,top:o,transform:"translate(-16px, -16px)"},color:D(p)})},onChange:r=>h(e({},p,r))}),(0,q.jsx)(ye,{hue:p.h,height:24,radius:d?"0 0 8px 8px":0,className:t,onChange:r=>h(e({},p,r)),pointer:e=>{var{left:r}=e;return(0,q.jsx)(Ye,{style:{left:r},color:"hsl("+(p.h||0)+"deg 100% 50%)"})}}),!d&&(0,q.jsx)(oe,{hsva:p,height:24,className:t,radius:"0 0 8px 8px",pointer:e=>{var{left:r}=e;return(0,q.jsx)(Ye,{style:{left:r},color:L(p)})},onChange:r=>h(e({},p,r))})]}))}));qe.displayName="Colorful";const Ve=qe;function Qe(r){var{style:o,title:t,checked:a,color:s,onClick:l,rectProps:n}=r,i=(0,O.useRef)(null),d=(0,O.useCallback)((()=>{i.current.style.transform="scale(1.2)"}),[]),c=(0,O.useCallback)((()=>{i.current.style.transform="scale(1)"}),[]),p=e({"--circle-point-background-color":"#fff",height:a?"100%":0,width:a?"100%":0,borderRadius:"50%",backgroundColor:"var(--circle-point-background-color)",boxSizing:"border-box",transition:"height 100ms ease 0s, width 100ms ease 0s"},n.style);return(0,q.jsx)("div",{ref:i,onClick:l,onMouseEnter:d,onMouseLeave:c,title:t,style:e({},o,{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,padding:3,borderRadius:"50%",marginRight:12,marginBottom:12,boxSizing:"border-box",transform:"scale(1)",boxShadow:s+" 0px 0px "+(a?5:0)+"px",transition:"transform 100ms ease 0s, box-shadow 100ms ease 0s"}),children:(0,q.jsx)("div",e({},n,{style:p}))})}var Ze=["prefixCls","className","color","colors","rectProps","onChange"],$e=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-circle",className:a,color:s,colors:n=[],rectProps:i={},onChange:d}=r,c=z(r,Ze),p="string"===typeof s&&l(s)?N(s):s||{},h=s?D(p):"";return(0,q.jsx)(se,e({ref:o,colors:n,color:h},c,{className:[t,a].filter(Boolean).join(" "),rectRender:r=>{var o=e({},(function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(r),r));return(0,q.jsx)(Qe,e({},o,{rectProps:i}))},onChange:e=>{d&&d(I(e))}}))}));$e.displayName="Circle";const Je=$e;var Ke=["prefixCls","className","style","color","onChange"],er={boxShadow:"initial",borderWidth:"0 0 1px 0",borderBottomColor:"var(--material-border-bottom-color)",borderBottomStyle:"solid",height:30,outline:0,fontSize:15,padding:0},rr=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-material",className:a,style:s,color:n,onChange:i}=r,d=z(r,Ke),c="string"===typeof n&&l(n)?N(n):n,p=n?D(c).replace(/^#/,""):"",h=(e,r)=>{"string"===typeof e&&l(e)&&/(3|6)/.test(String(e.length))&&i&&i(I(N(e)))},u=e({"--material-border-bottom-color":"#eee","--material-background-color":"#fff",padding:16,width:98,fontFamily:"Roboto",backgroundColor:"var(--material-background-color)"},s);return(0,q.jsxs)("div",e({ref:o,className:[t,a||""].filter(Boolean).join(" "),style:u},d,{children:[(0,q.jsx)(we,{label:"Hex",value:p.toLocaleUpperCase(),onChange:(e,r)=>h(r),onBlur:e=>{var r=e.target.value;e.target.value=r.slice(0,6),h(r.slice(0,6))},inputStyle:{outline:0,border:0,height:30,fontSize:15,padding:0,boxShadow:"initial",borderWidth:"0 0 2px 0",borderBottomColor:p?"#"+p:"var(--material-border-bottom-color)",borderBottomStyle:"solid",background:"transparent"},style:{flexDirection:"column-reverse",alignItems:"flex-start"}}),(0,q.jsx)(Re,{hsva:c,placement:"top",style:{marginTop:11},rProps:{style:{alignItems:"flex-start"},inputStyle:e({},er)},gProps:{style:{alignItems:"flex-start"},inputStyle:e({},er)},bProps:{style:{alignItems:"flex-start"},inputStyle:e({},er)},aProps:!1,onChange:e=>{return r=e.hsva,void(i&&i(I(r)));var r}})]}))}));rr.displayName="Material";const or=rr;var tr=["prefixCls","className","onChange","direction","hsva"],ar=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-saturation",className:a,onChange:s,direction:l="horizontal",hsva:n}=r,i=z(r,tr),d=g(e({},n,{a:1,v:100}));return(0,q.jsx)(oe,e({ref:o},i,{className:t+" "+(a||""),hsva:{h:n.h,s:n.s,v:n.v,a:1-n.v/100},direction:l,background:"linear-gradient(to "+("horizontal"===l?"right":"bottom")+", "+d+", rgb(0, 0, 0))",onChange:(e,r)=>{s&&s({v:"horizontal"===l?100-100*r.left:100-100*r.top})}}))}));ar.displayName="ShadeSlider";const sr=ar;var lr=["prefixCls","className","style","onChange","color","lightness"],nr=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-slider",className:a,style:s,onChange:n,color:i,lightness:d=[80,65,50,35,20]}=r,c=z(r,lr),h="string"===typeof i&&l(i)?N(i):i||{};return(0,q.jsx)("div",e({ref:o,style:e({display:"flex"},s),className:[t,a||""].filter(Boolean).join(" ")},c,{children:d.map(((r,o)=>{var t="hsl("+y(h).h+", 50%, "+r+"%)",a=t===p(h);return(0,q.jsx)("div",{style:{paddingLeft:1,width:100/d.length+"%",boxSizing:"border-box"},children:(0,q.jsx)("div",{onClick:e=>((e,r)=>{n&&n(I(x(e)),r)})(t,e),style:e({backgroundColor:t,height:12,cursor:"pointer"},a?{borderRadius:2,transform:"scale(1, 1.5)"}:{})})},o)}))}))}));nr.displayName="Slider";const ir=nr;var dr=["prefixCls","className","onChange","width","presetColors","color","editableDisable","disableAlpha","style"],cr=["#D0021B","#F5A623","#f8e61b","#8B572A","#7ED321","#417505","#BD10E0","#9013FE","#4A90E2","#50E3C2","#B8E986","#000000","#4A4A4A","#9B9B9B","#FFFFFF"],pr=e=>(0,q.jsx)("div",{style:{boxShadow:"rgb(0 0 0 / 60%) 0px 0px 2px",width:4,top:1,bottom:1,left:e.left,borderRadius:1,position:"absolute",backgroundColor:"#fff"}}),hr=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-sketch",className:a,onChange:s,width:n=218,presetColors:i=cr,color:d,editableDisable:c=!0,disableAlpha:p=!1,style:h}=r,u=z(r,dr),[g,b]=(0,O.useState)({h:209,s:36,v:90,a:1});(0,O.useEffect)((()=>{"string"===typeof d&&l(d)&&b(N(d)),"object"===typeof d&&b(d)}),[d]);var f=e=>{b(e),s&&s(I(e))},x=e({"--sketch-background":"rgb(255, 255, 255)","--sketch-box-shadow":"rgb(0 0 0 / 15%) 0px 0px 0px 1px, rgb(0 0 0 / 15%) 0px 8px 16px","--sketch-swatch-box-shadow":"rgb(0 0 0 / 15%) 0px 0px 0px 1px inset","--sketch-alpha-box-shadow":"rgb(0 0 0 / 15%) 0px 0px 0px 1px inset, rgb(0 0 0 / 25%) 0px 0px 4px inset","--sketch-swatch-border-top":"1px solid rgb(238, 238, 238)",background:"var(--sketch-background)",borderRadius:4,boxShadow:"var(--sketch-box-shadow)",width:n},h),v={borderRadius:2,background:L(g),boxShadow:"var(--sketch-alpha-box-shadow)"};return(0,q.jsxs)("div",e({},u,{className:t+" "+(a||""),ref:o,style:x,children:[(0,q.jsxs)("div",{style:{padding:"10px 10px 8px"},children:[(0,q.jsx)(fe,{hsva:g,style:{width:"auto",height:150},onChange:r=>f(e({},g,r,{a:g.a}))}),(0,q.jsxs)("div",{style:{display:"flex",marginTop:4},children:[(0,q.jsxs)("div",{style:{flex:1},children:[(0,q.jsx)(ye,{width:"auto",height:10,hue:g.h,pointer:pr,innerProps:{style:{marginLeft:1,marginRight:5}},onChange:r=>f(e({},g,r))}),!p&&(0,q.jsx)(oe,{width:"auto",height:10,hsva:g,pointer:pr,style:{marginTop:4},innerProps:{style:{marginLeft:1,marginRight:5}},onChange:r=>f(e({},g,{a:r.a}))})]}),!p&&(0,q.jsx)(oe,{width:24,height:24,hsva:g,radius:2,style:{marginLeft:4},bgProps:{style:{background:"transparent"}},innerProps:{style:v},pointer:()=>(0,q.jsx)(O.Fragment,{})})]})]}),c&&(0,q.jsxs)("div",{style:{display:"flex",margin:"0 10px 3px 10px"},children:[(0,q.jsx)(we,{label:"Hex",value:D(g).replace(/^#/,"").toLocaleUpperCase(),onChange:(e,r)=>{var o;"string"===typeof(o=r)&&l(o)&&/(3|6)/.test(String(o.length))&&f(N(o))},style:{minWidth:58}}),(0,q.jsx)(Re,{hsva:g,style:{marginLeft:6},aProps:!p&&{},onChange:e=>f(e.hsva)})]}),i&&i.length>0&&(0,q.jsx)(se,{style:{borderTop:"var(--sketch-swatch-border-top)",paddingTop:10,paddingLeft:10},colors:i,color:D(g),onChange:e=>f(e),rectProps:{style:{marginRight:10,marginBottom:10,borderRadius:3,boxShadow:"var(--sketch-swatch-box-shadow)"}}})]}))}));hr.displayName="Sketch";const ur=hr;var gr=r=>{var{className:o,color:t,left:a,top:s,style:l,prefixCls:n}=r,i=e({},l,{position:"absolute",top:s,left:a}),d=n+"-pointer "+(o||"");return(0,q.jsx)("div",{className:d,style:i,children:(0,q.jsx)("div",{className:n+"-fill",style:{width:10,height:10,transform:"translate(-5px, -5px)",boxShadow:"rgb(255 255 255) 0px 0px 0px 1.5px, rgb(0 0 0 / 30%) 0px 0px 1px 1px inset, rgb(0 0 0 / 40%) 0px 0px 1px 2px",borderRadius:"50%",backgroundColor:"#fff"},children:(0,q.jsx)("div",{style:{inset:0,borderRadius:"50%",position:"absolute",backgroundColor:t}})})})},br=2*Math.PI,fr=(e,r)=>(e%r+r)%r,xr=(e,r)=>Math.sqrt(e*e+r*r);function vr(e){var{width:r=0}=e,o=r/2;return{width:r,radius:o,cx:o,cy:o}}function yr(e){var{width:r=0}=e;return r/2}function mr(e,r,o){var t=e.angle||0,a=e.direction;return o&&"clockwise"===a?r=t+r:"clockwise"===a?r=360-t+r:o&&"anticlockwise"===a?r=t+180-r:"anticlockwise"===a&&(r=t-r),fr(r,360)}var Cr=["prefixCls","radius","pointer","className","style","width","height","direction","angle","color","onChange"],wr=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-wheel",radius:a=0,pointer:s,className:n,style:i,width:d=200,height:c=200,direction:p="anticlockwise",angle:h=180,color:u,onChange:g}=r,b=z(r,Cr),f="string"===typeof u&&l(u)?N(u):u||{},x=u?D(f):"",v=function(e,r){var{cx:o,cy:t}=vr(e),a=yr(e),s=(180+mr(e,r.h,!0))*(br/360),l=r.s/100*a,n="clockwise"===e.direction?-1:1;return{x:o+l*Math.cos(s)*n,y:t+l*Math.sin(s)*n}}({width:d},f),y={top:"0",left:"0",color:x},m=(e,r)=>{var o=function(e,r,o){var{cx:t,cy:a}=vr(e),s=yr(e);r=t-r,o=a-o;var l=mr(e,Math.atan2(-o,-r)*(360/br)),n=Math.min(xr(r,o),s);return{h:Math.round(l),s:Math.round(100/s*n)}}({width:d},d-e.x,c-e.y),t={h:o.h,s:o.s,v:f.v,a:f.a};g&&g(I(t))},C={zIndex:1,transform:"translate("+v.x+"px, "+v.y+"px)"},w=s&&"function"===typeof s?s(e({prefixCls:t,style:C},y)):(0,q.jsx)(gr,e({prefixCls:t,style:C},y));return(0,q.jsxs)(Z,e({className:[t,n||""].filter(Boolean).join(" ")},b,{style:e({position:"relative",width:d,height:c},i),ref:o,onMove:m,onDown:m,children:[w,(0,q.jsx)("div",{style:{position:"absolute",borderRadius:"50%",background:"anticlockwise"===p?"conic-gradient(red, yellow, lime, aqua, blue, magenta, red)":"conic-gradient(red, magenta, blue, aqua, lime, yellow, red)",transform:"rotateZ("+(h+90)+"deg)",inset:0}}),(0,q.jsx)("div",{style:{position:"absolute",borderRadius:"50%",background:"radial-gradient(circle closest-side, #fff, transparent)",inset:0}}),(0,q.jsx)("div",{style:{backgroundColor:"#000",borderRadius:"50%",position:"absolute",inset:0,opacity:"number"===typeof f.v?1-f.v/100:0}})]}))}));wr.displayName="Wheel";const jr=wr})(),a})()));
{
"name": "@uiw/react-color",
"version": "1.3.1",
"version": "1.3.2",
"description": "Color Picker component for React.",

@@ -50,21 +50,21 @@ "homepage": "https://uiwjs.github.io/react-color",

"dependencies": {
"@uiw/color-convert": "1.3.1",
"@uiw/react-color-alpha": "1.3.1",
"@uiw/react-color-block": "1.3.1",
"@uiw/react-color-chrome": "1.3.1",
"@uiw/react-color-circle": "1.3.1",
"@uiw/react-color-colorful": "1.3.1",
"@uiw/react-color-compact": "1.3.1",
"@uiw/react-color-editable-input": "1.3.1",
"@uiw/react-color-editable-input-hsla": "1.3.1",
"@uiw/react-color-editable-input-rgba": "1.3.1",
"@uiw/react-color-github": "1.3.1",
"@uiw/react-color-hue": "1.3.1",
"@uiw/react-color-material": "1.3.1",
"@uiw/react-color-saturation": "1.3.1",
"@uiw/react-color-shade-slider": "1.3.1",
"@uiw/react-color-sketch": "1.3.1",
"@uiw/react-color-slider": "1.3.1",
"@uiw/react-color-swatch": "1.3.1",
"@uiw/react-color-wheel": "1.3.1"
"@uiw/color-convert": "1.3.2",
"@uiw/react-color-alpha": "1.3.2",
"@uiw/react-color-block": "1.3.2",
"@uiw/react-color-chrome": "1.3.2",
"@uiw/react-color-circle": "1.3.2",
"@uiw/react-color-colorful": "1.3.2",
"@uiw/react-color-compact": "1.3.2",
"@uiw/react-color-editable-input": "1.3.2",
"@uiw/react-color-editable-input-hsla": "1.3.2",
"@uiw/react-color-editable-input-rgba": "1.3.2",
"@uiw/react-color-github": "1.3.2",
"@uiw/react-color-hue": "1.3.2",
"@uiw/react-color-material": "1.3.2",
"@uiw/react-color-saturation": "1.3.2",
"@uiw/react-color-shade-slider": "1.3.2",
"@uiw/react-color-sketch": "1.3.2",
"@uiw/react-color-slider": "1.3.2",
"@uiw/react-color-swatch": "1.3.2",
"@uiw/react-color-wheel": "1.3.2"
},

@@ -71,0 +71,0 @@ "devDependencies": {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc