@uiw/react-color
Advanced tools
Comparing version 2.0.5 to 2.0.6
/*! 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={837:(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},322:(e,r,o)=>{e.exports=o(837)},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:()=>ze,Chrome:()=>De,ChromeInputType:()=>Ee,Circle:()=>Ke,Colorful:()=>Qe,Compact:()=>Ue,EditableInput:()=>je,EditableInputHSLA:()=>Ae,EditableInputRGBA:()=>Se,Github:()=>ue,GithubPlacement:()=>pe,Hue:()=>ye,Material:()=>tr,Pointer:()=>J,Saturation:()=>xe,ShadeSlider:()=>lr,Sketch:()=>gr,Slider:()=>dr,Swatch:()=>le,Wheel:()=>kr,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:()=>y,hsvaToHex:()=>D,hsvaToHexa:()=>M,hsvaToHslString:()=>p,hsvaToHsla:()=>m,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}=m(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}=m(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}},m=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}},y=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=y,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=m(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(322),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),m=r=>{f&&f(e({},s,{a:"horizontal"===u?r.left:r.top}),r)},y=g(Object.assign({},s,{a:1})),C="linear-gradient(to "+("horizontal"===u?"right":"bottom")+", rgba(244, 67, 54, 0) 0%, "+y+" 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)"},{width:p,height:h},b,{position:"relative"}),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:m,onDown:m,children:k}))]}))}));re.displayName="Alpha";const oe=re;function te(e){if(null==e)throw new TypeError("Cannot destructure "+e)}var ae=["prefixCls","className","color","colors","style","rectProps","onChange","addonAfter","addonBefore","rectRender"],se=_().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,ae),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(),n=h&&h({title:t,color:a,checked:!!l,style:e({},g,{background:a}),onClick:e=>b(a,e)});if(n)return(0,q.jsx)(O.Fragment,{children:n},o);var d=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:d,style:e({},g,{background:a})}),o)})),c&&_().isValidElement(c)&&c]}))}));se.displayName="Swatch";const le=se;var ne={marginRight:0,marginBottom:0,borderRadius:0,boxSizing:"border-box",height:25,width:25};function ie(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]),p=a?{zIndex:1,outline:"#fff solid 2px",boxShadow:"rgb(0 0 0 / 25%) 0 0 5px 2px"}:{zIndex:0};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},ne,p,null==n?void 0:n.style)}))}var de=["prefixCls","placement","className","style","color","colors","rectProps","onChange","rectRender"],ce=["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],pe=function(e){return e.Left="L",e.LeftTop="LT",e.LeftBottom="LB",e.Right="R",e.RightTop="RT",e.RightBottom="RB",e.Top="T",e.TopRight="TR",e.TopLeft="TL",e.Bottom="B",e.BottomLeft="BL",e.BottomRight="BR",e}({}),he=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-github",placement:a=pe.TopRight,className:s,style:n,color:i,colors:d=ce,rectProps:c={},onChange:p,rectRender:h}=r,u=z(r,de),g="string"===typeof i&&l(i)?N(i):i,b=i?D(g):"",f=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),x={borderStyle:"solid",position:"absolute"},v=e({},x),m=e({},x);/^T/.test(a)&&(v.borderWidth="0 8px 8px",v.borderColor="transparent transparent var(--github-arrow-border-color)",m.borderWidth="0 7px 7px",m.borderColor="transparent transparent var(--github-background-color)"),a===pe.TopRight&&(v.top=-8,m.top=-7),a===pe.Top&&(v.top=-8,m.top=-7),a===pe.TopLeft&&(v.top=-8,m.top=-7),/^B/.test(a)&&(v.borderWidth="8px 8px 0",v.borderColor="var(--github-arrow-border-color) transparent transparent",m.borderWidth="7px 7px 0",m.borderColor="var(--github-background-color) transparent transparent",a===pe.BottomRight&&(v.top="100%",m.top="100%"),a===pe.Bottom&&(v.top="100%",m.top="100%"),a===pe.BottomLeft&&(v.top="100%",m.top="100%")),/^(B|T)/.test(a)&&(a!==pe.Top&&a!==pe.Bottom||(v.left="50%",v.marginLeft=-8,m.left="50%",m.marginLeft=-7),a!==pe.TopRight&&a!==pe.BottomRight||(v.right=10,m.right=11),a!==pe.TopLeft&&a!==pe.BottomLeft||(v.left=7,m.left=8)),/^L/.test(a)&&(v.borderWidth="8px 8px 8px 0",v.borderColor="transparent var(--github-arrow-border-color) transparent transparent",m.borderWidth="7px 7px 7px 0",m.borderColor="transparent var(--github-background-color) transparent transparent",v.left=-8,m.left=-7),/^R/.test(a)&&(v.borderWidth="8px 0 8px 8px",v.borderColor="transparent transparent transparent var(--github-arrow-border-color)",m.borderWidth="7px 0 7px 7px",m.borderColor="transparent transparent transparent var(--github-background-color)",v.right=-8,m.right=-7),/^(L|R)/.test(a)&&(a!==pe.RightTop&&a!==pe.LeftTop||(v.top=5,m.top=6),a!==pe.Left&&a!==pe.Right||(v.top="50%",m.top="50%",v.marginTop=-8,m.marginTop=-7),a!==pe.LeftBottom&&a!==pe.RightBottom||(v.top="100%",m.top="100%",v.marginTop=-21,m.marginTop=-20));return(0,q.jsx)(le,e({ref:o,className:[t,s].filter(Boolean).join(" "),colors:d,color:b,rectRender:r=>{var o=e({},(te(r),r)),t=h&&h(e({},o));return t||(0,q.jsx)(ie,e({},o,{rectProps:c}))}},u,{onChange:e=>p&&p(I(e)),style:f,rectProps:{style:{marginRight:0,marginBottom:0,borderRadius:0,height:25,width:25}},addonBefore:(0,q.jsxs)(O.Fragment,{children:[(0,q.jsx)("div",{style:v}),(0,q.jsx)("div",{style:m})]})}))}));he.displayName="Github";const ue=he;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])},be=["prefixCls","radius","pointer","className","hue","style","hsva","onChange"],fe=_().forwardRef(((r,o)=>{var t,{prefixCls:a="w-color-saturation",radius:s=0,pointer:l,className:n,hue:i=0,style:d,hsva:c,onChange:p}=r,h=z(r,be),u=e({width:200,height:200,borderRadius:s},d,{position:"relative"}),b=(e,r)=>{p&&c&&p({h:c.h,s:100*e.left,v:100*(1-e.top),a:c.a})},f=(0,O.useMemo)((()=>{if(!c)return null;var r={top:100-c.v+"%",left:c.s+"%",color:g(c)};return l&&"function"===typeof l?l(e({prefixCls:a},r)):(0,q.jsx)(ge,e({prefixCls:a},r))}),[c,l,a]);return(0,q.jsx)(Z,e({className:[a,n||""].filter(Boolean).join(" ")},h,{style:e({position:"absolute",inset:0,cursor:"crosshair",backgroundImage:"linear-gradient(0deg, #000, transparent), linear-gradient(90deg, #fff, hsl("+(null!=(t=null==c?void 0:c.h)?t:i)+", 100%, 50%))"},u),ref:o,onMove:b,onDown:b,children:f}))}));fe.displayName="Saturation";const xe=fe;var ve=["prefixCls","className","hue","onChange","direction"],me=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-hue",className:a,hue:s=0,onChange:l,direction:n="horizontal"}=r,i=z(r,ve);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})}}))}));me.displayName="Hue";const ye=me;var Ce=["prefixCls","placement","label","value","className","style","labelStyle","inputStyle","onChange","onBlur"],we=_().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,Ce),[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),m=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).trim().replace(/^#/,"");/^#?([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:m})),s&&(0,q.jsx)("span",{style:e({color:"var(--editable-input-label-color)",textTransform:"capitalize"},d),children:s})]})}));we.displayName="EditableInput";const je=we;var ke=["prefixCls","hsva","placement","rProps","gProps","bProps","aProps","className","style","onChange"],Re=_().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,ke),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)(je,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)(je,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)(je,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)(je,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)}))]}))}));Re.displayName="EditableInputRGBA";const Se=Re;var Be=["prefixCls","hsva","hProps","sProps","lProps","aProps","className","onChange"],Ne=_().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,Be),h=a?m(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)(Se,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))}));Ne.displayName="EditableInputHSLA";const Ae=Ne;var Pe=["style"];function Te(r){var{style:o}=r,t=z(r,Pe),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 Le=["prefixCls","className","style","color","inputType","rectProps","onChange"],Ee=function(e){return e.HEXA="hexa",e.RGBA="rgba",e.HSLA="hsla",e}({}),Fe=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-chrome",className:a,style:s,color:n,inputType:i=Ee.RGBA,rectProps:d={},onChange:c}=r,p=z(r,Le),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),m={"--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)(ue,e({ref:o,color:h,style:v,colors:void 0,className:[t,a].filter(Boolean).join(" "),placement:pe.TopLeft},p,{addonAfter:(0,q.jsxs)(O.Fragment,{children:[(0,q.jsx)(xe,{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:m},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==Ee.RGBA&&(0,q.jsx)(Se,{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===Ee.HEXA&&(0,q.jsx)(je,{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===Ee.HSLA&&(0,q.jsx)(Ae,{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)(Te,{onClick:()=>{g===Ee.RGBA&&b(Ee.HSLA),g===Ee.HSLA&&b(Ee.HEXA),g===Ee.HEXA&&b(Ee.RGBA)}})]})]}),rectRender:()=>(0,q.jsx)(O.Fragment,{})}))}));Fe.displayName="Chrome";const De=Fe;var Me=["prefixCls","className","style","color","colors","onChange"],He=["#D9E3F0","#F47373","#697689","#37D67A","#2CCCE4","#555555","#dce775","#ff8a65","#ba68c8"],Ie=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-block",className:a,style:s,color:i,colors:d=He,onChange:c}=r,p=z(r,Me),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)(le,{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)(je,{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"}})]}))}));Ie.displayName="Block";const ze=Ie;var Oe=["prefixCls","className","style","onChange","color","colors","rectProps","rectRender"],_e=["#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 We(e){return e.checked?(0,q.jsx)("div",{style:{height:5,width:5,borderRadius:"50%",backgroundColor:n(e.color)}}):null}var Ge=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-compact",className:a,style:s,onChange:n,color:i,colors:d=_e,rectProps:c,rectRender:p}=r,h=z(r,Oe),u="string"===typeof i&&l(i)?N(i):i,g=i?D(u).replace(/^#/,""):"",b=(0,O.useCallback)((e=>n&&n(I(e))),[]),f={style:{alignItems:"baseline"},inputStyle:{boxShadow:"none",backgroundColor:"transparent",outline:0}},x=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:x,className:[t,a||""].filter(Boolean).join(" ")},h,{children:[(0,q.jsx)(le,{colors:d,color:i?D(u):void 0,rectRender:p,rectProps:e({children:(0,q.jsx)(We,{})},c,{style:e({display:"flex",alignItems:"center",justifyContent:"center"},null==c?void 0:c.style)}),onChange:e=>b(e)}),(0,q.jsxs)("div",{style:{display:"flex",margin:"0 4px 3px 0"},children:[(0,q.jsx)(je,{onChange:(e,r)=>{var o;"string"===typeof(o=r)&&l(o)&&/(3|6)/.test(String(o.length))&&b(N(o))},labelStyle:{paddingRight:5,marginTop:-1},value:g.toLocaleUpperCase(),label:(0,q.jsx)("div",{style:{width:8,height:8,backgroundColor:"#"+g}}),inputStyle:{outline:"none",boxShadow:"initial",background:"transparent"},style:{flexDirection:"row-reverse",flex:"1 1 0%",minWidth:80}}),(0,q.jsx)(Se,{hsva:u,placement:"left",onChange:e=>b(e.hsva),aProps:!1,rProps:f,gProps:f,bProps:f})]})]}))}));Ge.displayName="Compact";const Ue=Ge;var Xe=["style","color"],Ye=["prefixCls","className","onChange","color","style","disableAlpha"],qe=r=>{var{style:o,color:t}=r,a=z(r,Xe),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%"}})}))},Ve=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-colorful",className:a,onChange:s,color:n,style:i,disableAlpha:d}=r,c=z(r,Ye),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)(xe,{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)(qe,{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)(qe,{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)(qe,{style:{left:r},color:L(p)})},onChange:r=>h(e({},p,r))})]}))}));Ve.displayName="Colorful";const Qe=Ve;function Ze(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 $e=["prefixCls","className","color","colors","rectProps","onChange"],Je=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-circle",className:a,color:s,colors:n=[],rectProps:i={},onChange:d}=r,c=z(r,$e),p="string"===typeof s&&l(s)?N(s):s||{},h=s?D(p):"";return(0,q.jsx)(le,e({ref:o,colors:n,color:h},c,{className:[t,a].filter(Boolean).join(" "),rectRender:r=>{var o=e({},(te(r),r));return(0,q.jsx)(Ze,e({},o,{rectProps:i}))},onChange:e=>{d&&d(I(e))}}))}));Je.displayName="Circle";const Ke=Je;var er=["prefixCls","className","style","color","onChange"],rr={boxShadow:"initial",borderWidth:"0 0 1px 0",borderBottomColor:"var(--material-border-bottom-color)",borderBottomStyle:"solid",height:30,outline:0,fontSize:15,padding:0},or=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-material",className:a,style:s,color:n,onChange:i}=r,d=z(r,er),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)(je,{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)(Se,{hsva:c,placement:"top",style:{marginTop:11},rProps:{style:{alignItems:"flex-start"},inputStyle:e({},rr)},gProps:{style:{alignItems:"flex-start"},inputStyle:e({},rr)},bProps:{style:{alignItems:"flex-start"},inputStyle:e({},rr)},aProps:!1,onChange:e=>{return r=e.hsva,void(i&&i(I(r)));var r}})]}))}));or.displayName="Material";const tr=or;var ar=["prefixCls","className","onChange","direction","hsva"],sr=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-saturation",className:a,onChange:s,direction:l="horizontal",hsva:n}=r,i=z(r,ar),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})}}))}));sr.displayName="ShadeSlider";const lr=sr;var nr=["prefixCls","className","style","onChange","color","lightness"],ir=_().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,nr),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("+m(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)}))}))}));ir.displayName="Slider";const dr=ir;var cr=["prefixCls","className","onChange","width","presetColors","color","editableDisable","disableAlpha","style"],pr=["#D0021B","#F5A623","#f8e61b","#8B572A","#7ED321","#417505","#BD10E0","#9013FE","#4A90E2","#50E3C2","#B8E986","#000000","#4A4A4A","#9B9B9B","#FFFFFF"],hr=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"}}),ur=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-sketch",className:a,onChange:s,width:n=218,presetColors:i=pr,color:d,editableDisable:c=!0,disableAlpha:p=!1,style:h}=r,u=z(r,cr),[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)(xe,{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:hr,innerProps:{style:{marginLeft:1,marginRight:5}},onChange:r=>f(e({},g,r))}),!p&&(0,q.jsx)(oe,{width:"auto",height:10,hsva:g,pointer:hr,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)(je,{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)(Se,{hsva:g,style:{marginLeft:6},aProps:!p&&{},onChange:e=>f(e.hsva)})]}),i&&i.length>0&&(0,q.jsx)(le,{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)"}}})]}))}));ur.displayName="Sketch";const gr=ur;var br=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}})})})},fr=2*Math.PI,xr=(e,r)=>(e%r+r)%r,vr=(e,r)=>Math.sqrt(e*e+r*r);function mr(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 Cr(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),xr(r,360)}var wr=["prefixCls","radius","pointer","className","style","width","height","oval","direction","angle","color","onChange"],jr=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-wheel",radius:a=0,pointer:s,className:n,style:i,width:d=200,height:c=200,oval:p,direction:h="anticlockwise",angle:u=180,color:g,onChange:b}=r,f=z(r,wr),x="string"===typeof g&&l(g)?N(g):g||{},v=g?D(x):"",m=function(e,r){var{cx:o,cy:t}=mr(e),a=yr(e),s=(180+Cr(e,r.h,!0))*(fr/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},x),y={top:"0",left:"0",color:v},C=(e,r)=>{var o=function(e,r,o){var{cx:t,cy:a}=mr(e),s=yr(e);r=t-r,o=a-o;var l=Cr(e,Math.atan2(-o,-r)*(360/fr)),n=Math.min(vr(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:x.v,a:x.a};b&&b(I(t))},w={zIndex:1,transform:"translate("+m.x+"px, "+m.y+"px) "+("x"===p||"X"===p?"scaleY(2)":"y"===p||"Y"===p?"scaleX(2)":"")},j=s&&"function"===typeof s?s(e({prefixCls:t,style:w},y)):(0,q.jsx)(br,e({prefixCls:t,style:w},y));return(0,q.jsxs)(Z,e({className:[t,n||""].filter(Boolean).join(" ")},f,{style:e({position:"relative",width:d,transform:"x"===p||"X"===p?"scaleY(0.5)":"y"===p||"Y"===p?"scaleX(0.5)":"",height:c},i),ref:o,onMove:C,onDown:C,children:[j,(0,q.jsx)("div",{style:{position:"absolute",borderRadius:"50%",background:"anticlockwise"===h?"conic-gradient(red, yellow, lime, aqua, blue, magenta, red)":"conic-gradient(red, magenta, blue, aqua, lime, yellow, red)",transform:"rotateZ("+(u+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 x.v?1-x.v/100:0}})]}))}));jr.displayName="Wheel";const kr=jr})(),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={837:(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},322:(e,r,o)=>{e.exports=o(837)},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:()=>ze,Chrome:()=>De,ChromeInputType:()=>Ee,Circle:()=>Ke,Colorful:()=>Qe,Compact:()=>Ue,EditableInput:()=>je,EditableInputHSLA:()=>Ae,EditableInputRGBA:()=>Se,Github:()=>ue,GithubPlacement:()=>pe,Hue:()=>ye,Material:()=>tr,Pointer:()=>J,Saturation:()=>xe,ShadeSlider:()=>lr,Sketch:()=>gr,Slider:()=>dr,Swatch:()=>le,Wheel:()=>kr,color:()=>E,equalColorObjects:()=>D,equalColorString:()=>M,equalHex:()=>H,getContrastingColor:()=>F,hexToHsva:()=>j,hexToRgba:()=>k,hslStringToHsla:()=>c,hslStringToHsva:()=>h,hslaStringToHsva:()=>p,hslaToHsl:()=>A,hslaToHsva:()=>u,hsvStringToHsva:()=>v,hsvaStringToHsva:()=>b,hsvaToHex:()=>P,hsvaToHexa:()=>T,hsvaToHslString:()=>l,hsvaToHsla:()=>g,hsvaToHslaString:()=>d,hsvaToHsv:()=>L,hsvaToHsvString:()=>n,hsvaToHsvaString:()=>i,hsvaToRgbString:()=>S,hsvaToRgba:()=>R,hsvaToRgbaString:()=>B,parseHue:()=>x,rgbStringToHsva:()=>y,rgbaStringToHsva:()=>m,rgbaToHex:()=>C,rgbaToHexa:()=>w,rgbaToHsva:()=>s,rgbaToRgb:()=>N,validHex:()=>I});var r=255,o=100,s=e=>{var{r:t,g:a,b:s,a:l}=e,n=Math.max(t,a,s),i=n-Math.min(t,a,s),d=i?n===t?(a-s)/i:n===a?2+(s-t)/i:4+(t-a)/i:0;return{h:60*(d<0?d+6:d),s:n?i/n*o:0,v:n/r*o,a:l}},l=e=>{var{h:r,s:o,l:t}=g(e);return"hsl("+r+", "+Math.round(o)+"%, "+Math.round(t)+"%)"},n=e=>{var{h:r,s:o,v:t}=e;return"hsv("+r+", "+o+"%, "+t+"%)"},i=e=>{var{h:r,s:o,v:t,a:a}=e;return"hsva("+r+", "+o+"%, "+t+"%, "+a+")"},d=e=>{var{h:r,s:o,l:t,a:a}=g(e);return"hsla("+r+", "+o+"%, "+t+"%, "+a+")"},c=e=>{var[r,o,t,a]=(e.match(/\d+/g)||[]).map(Number);return{h:r,s:o,l:t,a:a}},p=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?u({h:x(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}},h=p,u=e=>{var{h:r,s:t,l:a,a:s}=e;return{h:r,s:(t*=(a<50?a:o-a)/o)>0?2*t/(a+t)*o:0,v:a+t,a:s}},g=e=>{var{h:r,s:t,v:a,a:s}=e,l=(200-t)*a/o;return{h:r,s:l>0&&l<200?t*a/o/(l<=o?l:200-l)*o:0,l:l/2,a:s}},b=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:x(r[1],r[2]),s:Number(r[3]),v:Number(r[4]),a:void 0===r[5]?1:Number(r[5])/(r[6]?o:1)}:{h:0,s:0,v:0,a:1}},f={grad:.9,turn:360,rad:360/(2*Math.PI)},x=function(e,r){return void 0===r&&(r="deg"),Number(e)*(f[r]||1)},v=b,m=e=>{var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?s({r:Number(t[1])/(t[2]?o/r:1),g:Number(t[3])/(t[4]?o/r:1),b:Number(t[5])/(t[6]?o/r:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?o:1)}):{h:0,s:0,v:0,a:1}},y=m,C=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)},w=e=>{var{r:r,g:o,b:t,a:a}=e,s="number"===typeof a&&(255*a|256).toString(16).slice(1);return""+C({r:r,g:o,b:t,a:a})+(s||"")},j=e=>s(k(e)),k=e=>{var o=e.replace("#","");/^#?/.test(e)&&3===o.length&&(e="#"+o.charAt(0)+o.charAt(0)+o.charAt(1)+o.charAt(1)+o.charAt(2)+o.charAt(2));var t=new RegExp("[A-Za-z0-9]{2}","g"),[a,s,l=0,n]=e.match(t).map((e=>parseInt(e,16)));return{r:a,g:s,b:l,a:(null!=n?n:255)/r}},R=t=>{var{h:a,s:s,v:l,a:n}=t,i=a/60,d=s/o,c=l/o,p=Math.floor(i)%6,h=i-Math.floor(i),u=r*c*(1-d),g=r*c*(1-d*h),b=r*c*(1-d*(1-h));c*=r;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:n})},S=e=>{var{r:r,g:o,b:t}=R(e);return"rgb("+r+", "+o+", "+t+")"},B=e=>{var{r:r,g:o,b:t,a:a}=R(e);return"rgba("+r+", "+o+", "+t+", "+a+")"},N=e=>{var{r:r,g:o,b:t}=e;return{r:r,g:o,b:t}},A=e=>{var{h:r,s:o,l:t}=e;return{h:r,s:o,l:t}},P=e=>C(R(e)),T=e=>w(R(e)),L=e=>{var{h:r,s:o,v:t}=e;return{h:r,s:o,v:t}},E=e=>{var r,o,t,a,s,l,n,i;return"string"===typeof e&&I(e)?(l=j(e),n=e):"string"!==typeof e&&(l=e),l&&(t=L(l),s=g(l),a=R(l),i=w(a),n=P(l),o=A(s),r=N(a)),{rgb:r,hsl:o,hsv:t,rgba:a,hsla:s,hsva:l,hex:n,hexa:i}},F=e=>{if(!e)return"#ffffff";var r=E(e);return(299*r.rgb.r+587*r.rgb.g+114*r.rgb.b)/1e3>=128?"#000000":"#ffffff"},D=(e,r)=>{if(e===r)return!0;for(var o in e)if(e[o]!==r[o])return!1;return!0},M=(e,r)=>e.replace(/\s/g,"")===r.replace(/\s/g,""),H=(e,r)=>e.toLowerCase()===r.toLowerCase()||D(k(e),k(r)),I=e=>/^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(e);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(322),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:c={},radius:p=0,width:h,height:u=16,direction:g="horizontal",style:b,onChange:f,pointer:x}=r,v=z(r,K),m=r=>{f&&f(e({},s,{a:"horizontal"===g?r.left:r.top}),r)},y=d(Object.assign({},s,{a:1})),C="linear-gradient(to "+("horizontal"===g?"right":"bottom")+", rgba(244, 67, 54, 0) 0%, "+y+" 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:p,background:"url("+ee+") left center",backgroundColor:"var(--alpha-background-color)"},{width:h,height:u},b,{position:"relative"}),k=x&&"function"===typeof x?x(e({prefixCls:t},c,w)):(0,q.jsx)(J,e({},c,{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:p},n.style)})),(0,q.jsx)(Z,e({},i,{style:e({},i.style,{inset:0,zIndex:1,position:"absolute"}),onMove:m,onDown:m,children:k}))]}))}));re.displayName="Alpha";const oe=re;function te(e){if(null==e)throw new TypeError("Cannot destructure "+e)}var ae=["prefixCls","className","color","colors","style","rectProps","onChange","addonAfter","addonBefore","rectRender"],se=_().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,ae),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(j(e),E(j(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(),n=h&&h({title:t,color:a,checked:!!l,style:e({},g,{background:a}),onClick:e=>b(a,e)});if(n)return(0,q.jsx)(O.Fragment,{children:n},o);var d=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:d,style:e({},g,{background:a})}),o)})),c&&_().isValidElement(c)&&c]}))}));se.displayName="Swatch";const le=se;var ne={marginRight:0,marginBottom:0,borderRadius:0,boxSizing:"border-box",height:25,width:25};function ie(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]),p=a?{zIndex:1,outline:"#fff solid 2px",boxShadow:"rgb(0 0 0 / 25%) 0 0 5px 2px"}:{zIndex:0};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},ne,p,null==n?void 0:n.style)}))}var de=["prefixCls","placement","className","style","color","colors","rectProps","onChange","rectRender"],ce=["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],pe=function(e){return e.Left="L",e.LeftTop="LT",e.LeftBottom="LB",e.Right="R",e.RightTop="RT",e.RightBottom="RB",e.Top="T",e.TopRight="TR",e.TopLeft="TL",e.Bottom="B",e.BottomLeft="BL",e.BottomRight="BR",e}({}),he=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-github",placement:a=pe.TopRight,className:s,style:l,color:n,colors:i=ce,rectProps:d={},onChange:c,rectRender:p}=r,h=z(r,de),u="string"===typeof n&&I(n)?j(n):n,g=n?P(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},l),f={borderStyle:"solid",position:"absolute"},x=e({},f),v=e({},f);/^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===pe.TopRight&&(x.top=-8,v.top=-7),a===pe.Top&&(x.top=-8,v.top=-7),a===pe.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===pe.BottomRight&&(x.top="100%",v.top="100%"),a===pe.Bottom&&(x.top="100%",v.top="100%"),a===pe.BottomLeft&&(x.top="100%",v.top="100%")),/^(B|T)/.test(a)&&(a!==pe.Top&&a!==pe.Bottom||(x.left="50%",x.marginLeft=-8,v.left="50%",v.marginLeft=-7),a!==pe.TopRight&&a!==pe.BottomRight||(x.right=10,v.right=11),a!==pe.TopLeft&&a!==pe.BottomLeft||(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!==pe.RightTop&&a!==pe.LeftTop||(x.top=5,v.top=6),a!==pe.Left&&a!==pe.Right||(x.top="50%",v.top="50%",x.marginTop=-8,v.marginTop=-7),a!==pe.LeftBottom&&a!==pe.RightBottom||(x.top="100%",v.top="100%",x.marginTop=-21,v.marginTop=-20));return(0,q.jsx)(le,e({ref:o,className:[t,s].filter(Boolean).join(" "),colors:i,color:g,rectRender:r=>{var o=e({},(te(r),r)),t=p&&p(e({},o));return t||(0,q.jsx)(ie,e({},o,{rectProps:d}))}},h,{onChange:e=>c&&c(E(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})]})}))}));he.displayName="Github";const ue=he;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])},be=["prefixCls","radius","pointer","className","hue","style","hsva","onChange"],fe=_().forwardRef(((r,o)=>{var t,{prefixCls:a="w-color-saturation",radius:s=0,pointer:l,className:n,hue:i=0,style:c,hsva:p,onChange:h}=r,u=z(r,be),g=e({width:200,height:200,borderRadius:s},c,{position:"relative"}),b=(e,r)=>{h&&p&&h({h:p.h,s:100*e.left,v:100*(1-e.top),a:p.a})},f=(0,O.useMemo)((()=>{if(!p)return null;var r={top:100-p.v+"%",left:p.s+"%",color:d(p)};return l&&"function"===typeof l?l(e({prefixCls:a},r)):(0,q.jsx)(ge,e({prefixCls:a},r))}),[p,l,a]);return(0,q.jsx)(Z,e({className:[a,n||""].filter(Boolean).join(" ")},u,{style:e({position:"absolute",inset:0,cursor:"crosshair",backgroundImage:"linear-gradient(0deg, #000, transparent), linear-gradient(90deg, #fff, hsl("+(null!=(t=null==p?void 0:p.h)?t:i)+", 100%, 50%))"},g),ref:o,onMove:b,onDown:b,children:f}))}));fe.displayName="Saturation";const xe=fe;var ve=["prefixCls","className","hue","onChange","direction"],me=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-hue",className:a,hue:s=0,onChange:l,direction:n="horizontal"}=r,i=z(r,ve);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})}}))}));me.displayName="Hue";const ye=me;var Ce=["prefixCls","placement","label","value","className","style","labelStyle","inputStyle","onChange","onBlur"],we=_().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,Ce),[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),m=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).trim().replace(/^#/,"");/^#?([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:m})),s&&(0,q.jsx)("span",{style:e({color:"var(--editable-input-label-color)",textTransform:"capitalize"},d),children:s})]})}));we.displayName="EditableInput";const je=we;var ke=["prefixCls","hsva","placement","rProps","gProps","bProps","aProps","className","style","onChange"],Re=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-editable-input-rgba",hsva:a,placement:l="bottom",rProps:n={},gProps:i={},bProps:d={},aProps:c={},className:p,style:h,onChange:u}=r,g=z(r,ke),b=a?R(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(E(s(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(E(s(e({},b,{r:r})))),"g"===o&&u&&u(E(s(e({},b,{g:r})))),"b"===o&&u&&u(E(s(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)(je,e({label:"R",value:b.r||0,onBlur:f,placement:l,onChange:(e,r)=>x(r,"r",e)},n,{style:e({},n.style)})),(0,q.jsx)(je,e({label:"G",value:b.g||0,onBlur:f,placement:l,onChange:(e,r)=>x(r,"g",e)},i,{style:e({marginLeft:5},n.style)})),(0,q.jsx)(je,e({label:"B",value:b.b||0,onBlur:f,placement:l,onChange:(e,r)=>x(r,"b",e)},d,{style:e({marginLeft:5},d.style)})),c&&(0,q.jsx)(je,e({label:"A",value:b.a?parseInt(String(100*b.a),10):0,onBlur:f,placement:l,onChange:(e,r)=>x(r,"a",e)},c,{style:e({marginLeft:5},c.style)}))]}))}));Re.displayName="EditableInputRGBA";const Se=Re;var Be=["prefixCls","hsva","hProps","sProps","lProps","aProps","className","onChange"],Ne=_().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,Be),h=a?g(a):{h:0,s:0,l:0,a:0},b=(r,o,t)=>{"number"===typeof r&&("h"===o&&(r<0&&(r=0),r>360&&(r=360),c&&c(E(u(e({},h,{h:r}))))),"s"===o&&(r<0&&(r=0),r>100&&(r=100),c&&c(E(u(e({},h,{s:r}))))),"l"===o&&(r<0&&(r=0),r>100&&(r=100),c&&c(E(u(e({},h,{l:r}))))),"a"===o&&(r<0&&(r=0),r>1&&(r=1),c&&c(E(u(e({},h,{a:r}))))))};return(0,q.jsx)(Se,e({ref:o,hsva:a,rProps:e({label:"H",value:Math.round(h.h)},s,{onChange:(e,r)=>b(r,"h")}),gProps:e({label:"S",value:Math.round(h.s)+"%"},l,{onChange:(e,r)=>b(r,"s")}),bProps:e({label:"L",value:Math.round(h.l)+"%"},n,{onChange:(e,r)=>b(r,"l")}),aProps:e({label:"A",value:Math.round(100*h.a)/100},i,{onChange:(e,r)=>b(r,"a")}),className:[t,d||""].filter(Boolean).join(" ")},p))}));Ne.displayName="EditableInputHSLA";const Ae=Ne;var Pe=["style"];function Te(r){var{style:o}=r,t=z(r,Pe),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 Le=["prefixCls","className","style","color","inputType","rectProps","onChange"],Ee=function(e){return e.HEXA="hexa",e.RGBA="rgba",e.HSLA="hsla",e}({}),Fe=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-chrome",className:a,style:s,color:l,inputType:n=Ee.RGBA,rectProps:i={},onChange:d}=r,c=z(r,Le),p="string"===typeof l&&I(l)?j(l):l||{h:0,s:0,l:0,a:0},h=e=>d&&d(E(e)),[u,g]=(0,O.useState)(n),b={paddingTop:6},f={textAlign:"center",paddingTop:4,paddingBottom:4},x=e({"--chrome-arrow-fill":"#333","--chrome-arrow-background-color":"#e8e8e8",borderRadius:0,flexDirection:"column",width:230,padding:0},s),v={"--chrome-alpha-box-shadow":"rgb(0 0 0 / 25%) 0px 0px 1px inset",borderRadius:"50%",background:B(p),boxShadow:"var(--chrome-alpha-box-shadow)"};return(0,q.jsx)(ue,e({ref:o,color:p,style:x,colors:void 0,className:[t,a].filter(Boolean).join(" "),placement:pe.TopLeft},c,{addonAfter:(0,q.jsxs)(O.Fragment,{children:[(0,q.jsx)(xe,{hsva:p,style:{width:"100%",height:130},onChange:r=>{h(e({},p,r,{a:p.a}))}}),(0,q.jsxs)("div",{style:{padding:15,display:"flex",alignItems:"center"},children:[(0,q.jsx)(oe,{width:24,height:24,hsva:p,radius:2,style:{marginRight:15,borderRadius:"50%"},bgProps:{style:{background:"transparent"}},innerProps:{style:v},pointer:()=>(0,q.jsx)(O.Fragment,{})}),(0,q.jsxs)("div",{style:{flex:1},children:[(0,q.jsx)(ye,{hue:p.h,style:{width:"100%"},bgProps:{style:{borderRadius:2}},onChange:r=>{h(e({},p,r))}}),(0,q.jsx)(oe,{hsva:p,style:{marginTop:10},bgProps:{style:{borderRadius:2}},onChange:r=>{h(e({},p,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==Ee.RGBA&&(0,q.jsx)(Se,{hsva:p,rProps:{labelStyle:b,inputStyle:f},gProps:{labelStyle:b,inputStyle:f},bProps:{labelStyle:b,inputStyle:f},aProps:{labelStyle:b,inputStyle:f},onChange:e=>h(e.hsva)}),u===Ee.HEXA&&(0,q.jsx)(je,{label:"HEX",labelStyle:b,inputStyle:f,value:p.a>0&&p.a<1?T(p).toLocaleUpperCase():P(p).toLocaleUpperCase(),onChange:(e,r)=>{"string"===typeof r&&h(j(/^#/.test(r)?r:"#"+r))}}),u===Ee.HSLA&&(0,q.jsx)(Ae,{hsva:p,hProps:{labelStyle:b,inputStyle:f},sProps:{labelStyle:b,inputStyle:f},lProps:{labelStyle:b,inputStyle:f},aProps:{labelStyle:b,inputStyle:f},onChange:e=>h(e.hsva)})]}),(0,q.jsx)(Te,{onClick:()=>{u===Ee.RGBA&&g(Ee.HSLA),u===Ee.HSLA&&g(Ee.HEXA),u===Ee.HEXA&&g(Ee.RGBA)}})]})]}),rectRender:()=>(0,q.jsx)(O.Fragment,{})}))}));Fe.displayName="Chrome";const De=Fe;var Me=["prefixCls","className","style","color","colors","onChange"],He=["#D9E3F0","#F47373","#697689","#37D67A","#2CCCE4","#555555","#dce775","#ff8a65","#ba68c8"],Ie=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-block",className:a,style:s,color:l,colors:n=He,onChange:i}=r,d=z(r,Me),c="string"===typeof l&&I(l)?j(l):l,p=l?P(c):"",h=(e,r)=>{"string"===typeof e&&I(e)&&/(3|6)/.test(String(e.replace(/^#/,"").length))&&i&&i(E(j(e)))},u=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:u},d,{children:[(0,q.jsx)("div",{style:{width:0,height:0,borderStyle:"solid",borderWidth:"0 10px 10px",borderColor:"transparent transparent "+p,position:"absolute",top:-10,left:"50%",marginLeft:-10}}),(0,q.jsx)("div",{title:p,style:{backgroundColor:""+p,color:F(p),height:110,fontSize:18,borderRadius:"6px 6px 0 0",display:"flex",alignItems:"center",justifyContent:"center"},children:p.toLocaleUpperCase()}),(0,q.jsx)(le,{colors:n,color:p,style:{paddingLeft:10,paddingTop:10},rectProps:{style:{marginRight:10,marginBottom:10,borderRadius:4,height:22,width:22}},onChange:e=>{i&&i(E(e))}}),(0,q.jsx)(je,{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:{height:22,outline:0,borderRadius:3,padding:"0 7px"},style:{padding:10,paddingTop:0,borderRadius:"0 0 6px 6px"}})]}))}));Ie.displayName="Block";const ze=Ie;var Oe=["prefixCls","className","style","onChange","color","colors","rectProps","rectRender"],_e=["#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 We(e){return e.checked?(0,q.jsx)("div",{style:{height:5,width:5,borderRadius:"50%",backgroundColor:F(e.color)}}):null}var Ge=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-compact",className:a,style:s,onChange:l,color:n,colors:i=_e,rectProps:d,rectRender:c}=r,p=z(r,Oe),h="string"===typeof n&&I(n)?j(n):n,u=n?P(h).replace(/^#/,""):"",g=(0,O.useCallback)((e=>l&&l(E(e))),[]),b={style:{alignItems:"baseline"},inputStyle:{boxShadow:"none",backgroundColor:"transparent",outline:0}},f=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:f,className:[t,a||""].filter(Boolean).join(" ")},p,{children:[(0,q.jsx)(le,{colors:i,color:n?P(h):void 0,rectRender:c,rectProps:e({children:(0,q.jsx)(We,{})},d,{style:e({display:"flex",alignItems:"center",justifyContent:"center"},null==d?void 0:d.style)}),onChange:e=>g(e)}),(0,q.jsxs)("div",{style:{display:"flex",margin:"0 4px 3px 0"},children:[(0,q.jsx)(je,{onChange:(e,r)=>{var o;"string"===typeof(o=r)&&I(o)&&/(3|6)/.test(String(o.length))&&g(j(o))},labelStyle:{paddingRight:5,marginTop:-1},value:u.toLocaleUpperCase(),label:(0,q.jsx)("div",{style:{width:8,height:8,backgroundColor:"#"+u}}),inputStyle:{outline:"none",boxShadow:"initial",background:"transparent"},style:{flexDirection:"row-reverse",flex:"1 1 0%",minWidth:80}}),(0,q.jsx)(Se,{hsva:h,placement:"left",onChange:e=>g(e.hsva),aProps:!1,rProps:b,gProps:b,bProps:b})]})]}))}));Ge.displayName="Compact";const Ue=Ge;var Xe=["style","color"],Ye=["prefixCls","className","onChange","color","style","disableAlpha"],qe=r=>{var{style:o,color:t}=r,a=z(r,Xe),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%"}})}))},Ve=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-colorful",className:a,onChange:s,color:l,style:n,disableAlpha:i}=r,d=z(r,Ye),c="string"===typeof l&&I(l)?j(l):l||{},p=e=>s&&s(E(e));return(0,q.jsxs)("div",e({ref:o,style:e({width:200,position:"relative"},n)},d,{className:t+" "+(a||""),children:[(0,q.jsx)(xe,{hsva:c,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)(qe,{style:{left:r,top:o,transform:"translate(-16px, -16px)"},color:P(c)})},onChange:r=>p(e({},c,r))}),(0,q.jsx)(ye,{hue:c.h,height:24,radius:i?"0 0 8px 8px":0,className:t,onChange:r=>p(e({},c,r)),pointer:e=>{var{left:r}=e;return(0,q.jsx)(qe,{style:{left:r},color:"hsl("+(c.h||0)+"deg 100% 50%)"})}}),!i&&(0,q.jsx)(oe,{hsva:c,height:24,className:t,radius:"0 0 8px 8px",pointer:e=>{var{left:r}=e;return(0,q.jsx)(qe,{style:{left:r},color:B(c)})},onChange:r=>p(e({},c,r))})]}))}));Ve.displayName="Colorful";const Qe=Ve;function Ze(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 $e=["prefixCls","className","color","colors","rectProps","onChange"],Je=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-circle",className:a,color:s,colors:l=[],rectProps:n={},onChange:i}=r,d=z(r,$e),c="string"===typeof s&&I(s)?j(s):s||{},p=s?P(c):"";return(0,q.jsx)(le,e({ref:o,colors:l,color:p},d,{className:[t,a].filter(Boolean).join(" "),rectRender:r=>{var o=e({},(te(r),r));return(0,q.jsx)(Ze,e({},o,{rectProps:n}))},onChange:e=>{i&&i(E(e))}}))}));Je.displayName="Circle";const Ke=Je;var er=["prefixCls","className","style","color","onChange"],rr={boxShadow:"initial",borderWidth:"0 0 1px 0",borderBottomColor:"var(--material-border-bottom-color)",borderBottomStyle:"solid",height:30,outline:0,fontSize:15,padding:0},or=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-material",className:a,style:s,color:l,onChange:n}=r,i=z(r,er),d="string"===typeof l&&I(l)?j(l):l,c=l?P(d).replace(/^#/,""):"",p=(e,r)=>{"string"===typeof e&&I(e)&&/(3|6)/.test(String(e.length))&&n&&n(E(j(e)))},h=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:h},i,{children:[(0,q.jsx)(je,{label:"Hex",value:c.toLocaleUpperCase(),onChange:(e,r)=>p(r),onBlur:e=>{var r=e.target.value;e.target.value=r.slice(0,6),p(r.slice(0,6))},inputStyle:{outline:0,border:0,height:30,fontSize:15,padding:0,boxShadow:"initial",borderWidth:"0 0 2px 0",borderBottomColor:c?"#"+c:"var(--material-border-bottom-color)",borderBottomStyle:"solid",background:"transparent"},style:{flexDirection:"column-reverse",alignItems:"flex-start"}}),(0,q.jsx)(Se,{hsva:d,placement:"top",style:{marginTop:11},rProps:{style:{alignItems:"flex-start"},inputStyle:e({},rr)},gProps:{style:{alignItems:"flex-start"},inputStyle:e({},rr)},bProps:{style:{alignItems:"flex-start"},inputStyle:e({},rr)},aProps:!1,onChange:e=>{return r=e.hsva,void(n&&n(E(r)));var r}})]}))}));or.displayName="Material";const tr=or;var ar=["prefixCls","className","onChange","direction","hsva"],sr=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-saturation",className:a,onChange:s,direction:l="horizontal",hsva:n}=r,i=z(r,ar),c=d(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")+", "+c+", rgb(0, 0, 0))",onChange:(e,r)=>{s&&s({v:"horizontal"===l?100-100*r.left:100-100*r.top})}}))}));sr.displayName="ShadeSlider";const lr=sr;var nr=["prefixCls","className","style","onChange","color","lightness"],ir=_().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,nr),p="string"===typeof i&&I(i)?j(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("+g(p).h+", 50%, "+r+"%)",a=t===l(p);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(E(h(e)),r)})(t,e),style:e({backgroundColor:t,height:12,cursor:"pointer"},a?{borderRadius:2,transform:"scale(1, 1.5)"}:{})})},o)}))}))}));ir.displayName="Slider";const dr=ir;var cr=["prefixCls","className","onChange","width","presetColors","color","editableDisable","disableAlpha","style"],pr=["#D0021B","#F5A623","#f8e61b","#8B572A","#7ED321","#417505","#BD10E0","#9013FE","#4A90E2","#50E3C2","#B8E986","#000000","#4A4A4A","#9B9B9B","#FFFFFF"],hr=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"}}),ur=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-sketch",className:a,onChange:s,width:l=218,presetColors:n=pr,color:i,editableDisable:d=!0,disableAlpha:c=!1,style:p}=r,h=z(r,cr),[u,g]=(0,O.useState)({h:209,s:36,v:90,a:1});(0,O.useEffect)((()=>{"string"===typeof i&&I(i)&&g(j(i)),"object"===typeof i&&g(i)}),[i]);var b=e=>{g(e),s&&s(E(e))},f=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:l},p),x={borderRadius:2,background:B(u),boxShadow:"var(--sketch-alpha-box-shadow)"};return(0,q.jsxs)("div",e({},h,{className:t+" "+(a||""),ref:o,style:f,children:[(0,q.jsxs)("div",{style:{padding:"10px 10px 8px"},children:[(0,q.jsx)(xe,{hsva:u,style:{width:"auto",height:150},onChange:r=>b(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:hr,innerProps:{style:{marginLeft:1,marginRight:5}},onChange:r=>b(e({},u,r))}),!c&&(0,q.jsx)(oe,{width:"auto",height:10,hsva:u,pointer:hr,style:{marginTop:4},innerProps:{style:{marginLeft:1,marginRight:5}},onChange:r=>b(e({},u,{a:r.a}))})]}),!c&&(0,q.jsx)(oe,{width:24,height:24,hsva:u,radius:2,style:{marginLeft:4},bgProps:{style:{background:"transparent"}},innerProps:{style:x},pointer:()=>(0,q.jsx)(O.Fragment,{})})]})]}),d&&(0,q.jsxs)("div",{style:{display:"flex",margin:"0 10px 3px 10px"},children:[(0,q.jsx)(je,{label:"Hex",value:P(u).replace(/^#/,"").toLocaleUpperCase(),onChange:(e,r)=>{var o;"string"===typeof(o=r)&&I(o)&&/(3|6)/.test(String(o.length))&&b(j(o))},style:{minWidth:58}}),(0,q.jsx)(Se,{hsva:u,style:{marginLeft:6},aProps:!c&&{},onChange:e=>b(e.hsva)})]}),n&&n.length>0&&(0,q.jsx)(le,{style:{borderTop:"var(--sketch-swatch-border-top)",paddingTop:10,paddingLeft:10},colors:n,color:P(u),onChange:e=>b(e),rectProps:{style:{marginRight:10,marginBottom:10,borderRadius:3,boxShadow:"var(--sketch-swatch-box-shadow)"}}})]}))}));ur.displayName="Sketch";const gr=ur;var br=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}})})})},fr=2*Math.PI,xr=(e,r)=>(e%r+r)%r,vr=(e,r)=>Math.sqrt(e*e+r*r);function mr(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 Cr(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),xr(r,360)}var wr=["prefixCls","radius","pointer","className","style","width","height","oval","direction","angle","color","onChange"],jr=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-wheel",radius:a=0,pointer:s,className:l,style:n,width:i=200,height:d=200,oval:c,direction:p="anticlockwise",angle:h=180,color:u,onChange:g}=r,b=z(r,wr),f="string"===typeof u&&I(u)?j(u):u||{},x=u?P(f):"",v=function(e,r){var{cx:o,cy:t}=mr(e),a=yr(e),s=(180+Cr(e,r.h,!0))*(fr/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:i},f),m={top:"0",left:"0",color:x},y=(e,r)=>{var o=function(e,r,o){var{cx:t,cy:a}=mr(e),s=yr(e);r=t-r,o=a-o;var l=Cr(e,Math.atan2(-o,-r)*(360/fr)),n=Math.min(vr(r,o),s);return{h:Math.round(l),s:Math.round(100/s*n)}}({width:i},i-e.x,d-e.y),t={h:o.h,s:o.s,v:f.v,a:f.a};g&&g(E(t))},C={zIndex:1,transform:"translate("+v.x+"px, "+v.y+"px) "+("x"===c||"X"===c?"scaleY(2)":"y"===c||"Y"===c?"scaleX(2)":"")},w=s&&"function"===typeof s?s(e({prefixCls:t,style:C},m)):(0,q.jsx)(br,e({prefixCls:t,style:C},m));return(0,q.jsxs)(Z,e({className:[t,l||""].filter(Boolean).join(" ")},b,{style:e({position:"relative",width:i,transform:"x"===c||"X"===c?"scaleY(0.5)":"y"===c||"Y"===c?"scaleX(0.5)":"",height:d},n),ref:o,onMove:y,onDown:y,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}})]}))}));jr.displayName="Wheel";const kr=jr})(),a})())); |
{ | ||
"name": "@uiw/react-color", | ||
"version": "2.0.5", | ||
"version": "2.0.6", | ||
"description": "Color Picker component for React.", | ||
@@ -51,21 +51,21 @@ "homepage": "https://uiwjs.github.io/react-color", | ||
"dependencies": { | ||
"@uiw/color-convert": "2.0.5", | ||
"@uiw/react-color-alpha": "2.0.5", | ||
"@uiw/react-color-block": "2.0.5", | ||
"@uiw/react-color-chrome": "2.0.5", | ||
"@uiw/react-color-circle": "2.0.5", | ||
"@uiw/react-color-colorful": "2.0.5", | ||
"@uiw/react-color-compact": "2.0.5", | ||
"@uiw/react-color-editable-input": "2.0.5", | ||
"@uiw/react-color-editable-input-hsla": "2.0.5", | ||
"@uiw/react-color-editable-input-rgba": "2.0.5", | ||
"@uiw/react-color-github": "2.0.5", | ||
"@uiw/react-color-hue": "2.0.5", | ||
"@uiw/react-color-material": "2.0.5", | ||
"@uiw/react-color-saturation": "2.0.5", | ||
"@uiw/react-color-shade-slider": "2.0.5", | ||
"@uiw/react-color-sketch": "2.0.5", | ||
"@uiw/react-color-slider": "2.0.5", | ||
"@uiw/react-color-swatch": "2.0.5", | ||
"@uiw/react-color-wheel": "2.0.5" | ||
"@uiw/color-convert": "2.0.6", | ||
"@uiw/react-color-alpha": "2.0.6", | ||
"@uiw/react-color-block": "2.0.6", | ||
"@uiw/react-color-chrome": "2.0.6", | ||
"@uiw/react-color-circle": "2.0.6", | ||
"@uiw/react-color-colorful": "2.0.6", | ||
"@uiw/react-color-compact": "2.0.6", | ||
"@uiw/react-color-editable-input": "2.0.6", | ||
"@uiw/react-color-editable-input-hsla": "2.0.6", | ||
"@uiw/react-color-editable-input-rgba": "2.0.6", | ||
"@uiw/react-color-github": "2.0.6", | ||
"@uiw/react-color-hue": "2.0.6", | ||
"@uiw/react-color-material": "2.0.6", | ||
"@uiw/react-color-saturation": "2.0.6", | ||
"@uiw/react-color-shade-slider": "2.0.6", | ||
"@uiw/react-color-sketch": "2.0.6", | ||
"@uiw/react-color-slider": "2.0.6", | ||
"@uiw/react-color-swatch": "2.0.6", | ||
"@uiw/react-color-wheel": "2.0.6" | ||
}, | ||
@@ -72,0 +72,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
181906
3351
+ Added@uiw/color-convert@2.0.6(transitive)
+ Added@uiw/react-color-alpha@2.0.6(transitive)
+ Added@uiw/react-color-block@2.0.6(transitive)
+ Added@uiw/react-color-chrome@2.0.6(transitive)
+ Added@uiw/react-color-circle@2.0.6(transitive)
+ Added@uiw/react-color-colorful@2.0.6(transitive)
+ Added@uiw/react-color-compact@2.0.6(transitive)
+ Added@uiw/react-color-editable-input@2.0.6(transitive)
+ Added@uiw/react-color-editable-input-hsla@2.0.6(transitive)
+ Added@uiw/react-color-editable-input-rgba@2.0.6(transitive)
+ Added@uiw/react-color-github@2.0.6(transitive)
+ Added@uiw/react-color-hue@2.0.6(transitive)
+ Added@uiw/react-color-material@2.0.6(transitive)
+ Added@uiw/react-color-saturation@2.0.6(transitive)
+ Added@uiw/react-color-shade-slider@2.0.6(transitive)
+ Added@uiw/react-color-sketch@2.0.6(transitive)
+ Added@uiw/react-color-slider@2.0.6(transitive)
+ Added@uiw/react-color-swatch@2.0.6(transitive)
+ Added@uiw/react-color-wheel@2.0.6(transitive)
+ Added@uiw/react-drag-event-interactive@2.0.6(transitive)
- Removed@uiw/color-convert@2.0.5(transitive)
- Removed@uiw/react-color-alpha@2.0.5(transitive)
- Removed@uiw/react-color-block@2.0.5(transitive)
- Removed@uiw/react-color-chrome@2.0.5(transitive)
- Removed@uiw/react-color-circle@2.0.5(transitive)
- Removed@uiw/react-color-colorful@2.0.5(transitive)
- Removed@uiw/react-color-compact@2.0.5(transitive)
- Removed@uiw/react-color-editable-input@2.0.5(transitive)
- Removed@uiw/react-color-editable-input-hsla@2.0.5(transitive)
- Removed@uiw/react-color-editable-input-rgba@2.0.5(transitive)
- Removed@uiw/react-color-github@2.0.5(transitive)
- Removed@uiw/react-color-hue@2.0.5(transitive)
- Removed@uiw/react-color-material@2.0.5(transitive)
- Removed@uiw/react-color-saturation@2.0.5(transitive)
- Removed@uiw/react-color-shade-slider@2.0.5(transitive)
- Removed@uiw/react-color-sketch@2.0.5(transitive)
- Removed@uiw/react-color-slider@2.0.5(transitive)
- Removed@uiw/react-color-swatch@2.0.5(transitive)
- Removed@uiw/react-color-wheel@2.0.5(transitive)
- Removed@uiw/react-drag-event-interactive@2.0.5(transitive)
Updated@uiw/color-convert@2.0.6
Updated@uiw/react-color-alpha@2.0.6
Updated@uiw/react-color-block@2.0.6
Updated@uiw/react-color-hue@2.0.6
Updated@uiw/react-color-wheel@2.0.6