@uiw/react-color
Advanced tools
Comparing version 1.2.4 to 1.3.0
/*! 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={858:(e,r,t)=>{var o=t(787),a=Symbol.for("react.element"),s=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,l=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function d(e,r,t){var o,s={},d=null,p=null;for(o in void 0!==t&&(d=""+t),void 0!==r.key&&(d=""+r.key),void 0!==r.ref&&(p=r.ref),r)n.call(r,o)&&!i.hasOwnProperty(o)&&(s[o]=r[o]);if(e&&e.defaultProps)for(o in r=e.defaultProps)void 0===s[o]&&(s[o]=r[o]);return{$$typeof:a,type:e,key:d,ref:p,props:s,_owner:l.current}}r.jsx=d,r.jsxs=d},664:(e,r,t)=>{e.exports=t(858)},787:r=>{r.exports=e}},t={};function o(e){var a=t[e];if(void 0!==a)return a.exports;var s=t[e]={exports:{}};return r[e](s,s.exports,o),s.exports}o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.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 t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},e.apply(this,arguments)}o.r(a),o.d(a,{Alpha:()=>re,BACKGROUND_IMG:()=>K,Block:()=>He,Chrome:()=>Le,ChromeInputType:()=>Te,Circle:()=>$e,Colorful:()=>qe,Compact:()=>We,EditableInput:()=>Ce,EditableInputHSLA:()=>Ne,EditableInputRGBA:()=>Re,Github:()=>ce,GithubPlacement:()=>de,Hue:()=>ve,Material:()=>rr,Pointer:()=>$,Saturation:()=>fe,ShadeSlider:()=>ar,Sketch:()=>hr,Slider:()=>lr,Swatch:()=>ae,Wheel:()=>wr,color:()=>I,equalColorObjects:()=>r,equalColorString:()=>t,equalHex:()=>s,getContrastingColor:()=>l,hexToHsva:()=>A,hexToRgba:()=>k,hslStringToHsla:()=>f,hslStringToHsva:()=>b,hslaStringToHsva:()=>x,hslaToHsl:()=>F,hslaToHsva:()=>v,hsvStringToHsva:()=>j,hsvaStringToHsva:()=>m,hsvaToHex:()=>D,hsvaToHexa:()=>M,hsvaToHslString:()=>c,hsvaToHsla:()=>y,hsvaToHslaString:()=>u,hsvaToHsv:()=>H,hsvaToHsvString:()=>h,hsvaToHsvaString:()=>g,hsvaToRgbString:()=>T,hsvaToRgba:()=>P,hsvaToRgbaString:()=>E,parseHue:()=>w,rgbStringToHsva:()=>S,rgbaStringToHsva:()=>R,rgbaToHex:()=>B,rgbaToHexa:()=>N,rgbaToHsva:()=>p,rgbaToRgb:()=>L,validHex:()=>n});var r=(e,r)=>{if(e===r)return!0;for(var t in e)if(e[t]!==r[t])return!1;return!0},t=(e,r)=>e.replace(/\s/g,"")===r.replace(/\s/g,""),s=(e,t)=>e.toLowerCase()===t.toLowerCase()||r(k(e),k(t)),n=e=>/^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(e),l=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,p=e=>{var{r:r,g:t,b:o,a:a}=e,s=Math.max(r,t,o),n=s-Math.min(r,t,o),l=n?s===r?(t-o)/n:s===t?2+(o-r)/n:4+(r-t)/n:0;return{h:60*(l<0?l+6:l),s:s?n/s*d:0,v:s/i*d,a:a}},c=e=>{var{h:r,s:t,l:o}=y(e);return"hsl("+r+", "+Math.round(t)+"%, "+Math.round(o)+"%)"},h=e=>{var{h:r,s:t,v:o}=e;return"hsv("+r+", "+t+"%, "+o+"%)"},g=e=>{var{h:r,s:t,v:o,a:a}=e;return"hsva("+r+", "+t+"%, "+o+"%, "+a+")"},u=e=>{var{h:r,s:t,l:o,a:a}=y(e);return"hsla("+r+", "+t+"%, "+o+"%, "+a+")"},f=e=>{var[r,t,o,a]=(e.match(/\d+/g)||[]).map(Number);return{h:r,s:t,l:o,a:a}},x=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}},b=x,v=e=>{var{h:r,s:t,l:o,a:a}=e;return{h:r,s:(t*=(o<50?o:d-o)/d)>0?2*t/(o+t)*d:0,v:o+t,a:a}},y=e=>{var{h:r,s:t,v:o,a:a}=e,s=(200-t)*o/d;return{h:r,s:s>0&&s<200?t*o/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,R=e=>{var r=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?p({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}},S=R,B=e=>{var r,{r:t,g:o,b:a}=e;return"#"+(r=(t<<16|o<<8|a).toString(16),new Array(7-r.length).join("0")+r)},N=e=>{var{r:r,g:t,b:o,a:a}=e,s="number"===typeof a&&(255*a|256).toString(16).slice(1);return""+B({r:r,g:t,b:o,a:a})+(s||"")},A=e=>p(k(e)),k=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 t=new RegExp("[A-Za-z0-9]{2}","g"),[o,a,s=0,n]=e.match(t).map((e=>parseInt(e,16)));return{r:o,g:a,b:s,a:n?n/i:1}},P=r=>{var{h:t,s:o,v:a,a:s}=r,n=t/60,l=o/d,p=a/d,c=Math.floor(n)%6,h=n-Math.floor(n),g=i*p*(1-l),u=i*p*(1-l*h),f=i*p*(1-l*(1-h));p*=i;var x={};switch(c){case 0:x.r=p,x.g=f,x.b=g;break;case 1:x.r=u,x.g=p,x.b=g;break;case 2:x.r=g,x.g=p,x.b=f;break;case 3:x.r=g,x.g=u,x.b=p;break;case 4:x.r=f,x.g=g,x.b=p;break;case 5:x.r=p,x.g=g,x.b=u}return x.r=Math.round(x.r),x.g=Math.round(x.g),x.b=Math.round(x.b),e({},x,{a:s})},T=e=>{var{r:r,g:t,b:o}=P(e);return"rgb("+r+", "+t+", "+o+")"},E=e=>{var{r:r,g:t,b:o,a:a}=P(e);return"rgba("+r+", "+t+", "+o+", "+a+")"},L=e=>{var{r:r,g:t,b:o}=e;return{r:r,g:t,b:o}},F=e=>{var{h:r,s:t,l:o}=e;return{h:r,s:t,l:o}},D=e=>B(P(e)),M=e=>N(P(e)),H=e=>{var{h:r,s:t,v:o}=e;return{h:r,s:t,v:o}},I=e=>{var r,t,o,a,s,l,i,d;return"string"===typeof e&&n(e)?(l=A(e),i=e):"string"!==typeof e&&(l=e),l&&(o=H(l),s=y(l),a=P(l),d=N(a),i=D(l),t=F(s),r=L(a)),{rgb:r,hsl:t,hsv:o,rgba:a,hsla:s,hsva:l,hex:i,hexa:d}};function z(e,r){if(null==e)return{};var t,o,a={},s=Object.keys(e);for(o=0;o<s.length;o++)t=s[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}var O=o(787),_=o.n(O);function W(e){var r=(0,O.useRef)(e);return(0,O.useEffect)((()=>{r.current=e})),(0,O.useCallback)(((e,t)=>r.current&&r.current(e,t)),[])}var G=e=>"touches"in e,U=e=>{!G(e)&&e.preventDefault&&e.preventDefault()},X=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=1),e>t?t:e<r?r:e},Y=(e,r)=>{var t=e.getBoundingClientRect(),o=G(r)?r.touches[0]:r;return{left:X((o.pageX-(t.left+window.pageXOffset))/t.width),top:X((o.pageY-(t.top+window.pageYOffset))/t.height),width:t.width,height:t.height,x:o.pageX-(t.left+window.pageXOffset),y:o.pageY-(t.top+window.pageYOffset)}},q=o(664),V=["prefixCls","className","onMove","onDown"],Q=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-interactive",className:a,onMove:s,onDown:n}=r,l=z(r,V),i=(0,O.useRef)(null),d=(0,O.useRef)(!1),[p,c]=(0,O.useState)(!1),h=W(s),g=W(n),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):c(!1)}),[h]),f=(0,O.useCallback)((()=>c(!1)),[]),x=(0,O.useCallback)((e=>{var r=e?window.addEventListener:window.removeEventListener;r(d.current?"touchmove":"mousemove",u),r(d.current?"touchend":"mouseup",f)}),[]);(0,O.useEffect)((()=>(x(p),()=>{p&&x(!1)})),[p,x]);var b=(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),c(!0))}),[g]);return(0,q.jsx)("div",e({},l,{className:[o,a||""].filter(Boolean).join(" "),style:e({},l.style,{touchAction:"none"}),ref:i,tabIndex:0,onMouseDown:b,onTouchStart:b}))}));Q.displayName="Interactive";const Z=Q;var $=e=>{var{className:r,prefixCls:t,left:o,top:a}=e,s={position:"absolute",left:o,top:a};return(0,O.useMemo)((()=>(0,q.jsx)("div",{className:t+"-pointer "+(r||""),style:s,children:(0,q.jsx)("div",{className:t+"-fill",style:{width:18,height:18,transform:o?"translate(-9px, -1px)":"translate(-1px, -9px)",boxShadow:"rgb(0 0 0 / 37%) 0px 1px 4px 0px",borderRadius:"50%",backgroundColor:"rgb(248, 248, 248)"}})})),[r,o,a,t])},J=["prefixCls","className","hsva","background","bgProps","innerProps","radius","width","height","direction","style","onChange","pointer"],K="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==",ee=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-alpha",className:a,hsva:s,background:n,bgProps:l={},innerProps:i={},radius:d=0,width:p,height:c=16,direction:h="horizontal",style:g,onChange:f,pointer:x}=r,b=z(r,J),v=r=>{f&&f(e({},s,{a:"horizontal"===h?r.left:r.top}),r)},y=u(Object.assign({},s,{a:1})),m="linear-gradient(to "+("horizontal"===h?"right":"bottom")+", rgba(244, 67, 54, 0) 0%, "+y+" 100%)",C={};return"horizontal"===h?C.left=100*s.a+"%":C.top=100*s.a+"%",(0,q.jsxs)("div",e({},b,{className:[o,o+"-"+h,a||""].filter(Boolean).join(" "),style:e({borderRadius:d,background:"url("+K+") left center",backgroundColor:"#fff"},g,{position:"relative"},{width:p,height:c}),ref:t,children:[(0,q.jsx)("div",e({},l,{style:e({inset:0,position:"absolute",background:n||m,borderRadius:d},l.style)})),(0,q.jsx)(Z,e({},i,{style:e({},i.style,{inset:0,zIndex:1,position:"absolute"}),onMove:v,onDown:v,children:_().createElement(x||$,e({prefixCls:o},C))}))]}))}));ee.displayName="Aplha";const re=ee;var te=["prefixCls","className","color","colors","style","rectProps","onChange","addonAfter","addonBefore","rectRender"],oe=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-swatch",className:a,color:s,colors:n=[],style:l,rectProps:i={},onChange:d,addonAfter:p,addonBefore:c,rectRender:h}=r,g=z(r,te),u=e({background:"rgb(144, 19, 254)",height:15,width:15,marginRight:5,marginBottom:5,cursor:"pointer",position:"relative",outline:"none",borderRadius:2},i.style),f=(e,r)=>{d&&d(A(e),I(A(e)),r)};return(0,q.jsxs)("div",e({ref:t},g,{className:[o,a||""].filter(Boolean).join(" "),style:e({display:"flex",flexWrap:"wrap",position:"relative"},l),children:[c&&_().isValidElement(c)&&c,n&&Array.isArray(n)&&n.map(((r,t)=>{var o="",a="";"string"===typeof r&&(o=r,a=r),"object"===typeof r&&r.color&&(o=r.title||r.color,a=r.color);var n=s&&s.toLocaleLowerCase()===a.toLocaleLowerCase();if(h)return h({key:t,title:o,color:a,checked:!!n,style:e({},u,{background:a}),onClick:e=>f(a,e)});var l=i.children&&_().isValidElement(i.children)?_().cloneElement(i.children,{color:a,checked:n}):null;return(0,q.jsx)("div",e({tabIndex:0,title:o,onClick:e=>f(a,e)},i,{children:l,style:e({},u,{background:a})}),t)})),p&&_().isValidElement(p)&&p]}))}));oe.displayName="Swatch";const ae=oe;function se(r){var{style:t,title:o,checked:a,color:s,onClick:n,rectProps:l}=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"}),[]),p=(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:o},l,{onClick:n,onMouseEnter:d,onMouseLeave:p,style:e({},t,{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},l.style)}))}var ne=["prefixCls","placement","className","style","color","colors","rectProps","onChange"],le=["key"],ie=["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],de=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,t)=>{var{prefixCls:o="w-color-github",placement:a=de.TopRight,className:s,style:l,color:i,colors:d=ie,rectProps:p={},onChange:c}=r,h=z(r,ne),g="string"===typeof i&&n(i)?A(i):i,u=i?D(g):"",f={borderStyle:"solid",position:"absolute"},x=e({},f),b=e({},f);return/^T/.test(a)&&(x.borderWidth="0 8px 8px",x.borderColor="transparent transparent rgba(0, 0, 0, 0.15)",b.borderWidth="0 7px 7px",b.borderColor="transparent transparent #fff"),a===de.TopRight&&(x.top=-8,b.top=-7),a===de.Top&&(x.top=-8,b.top=-7),a===de.TopLeft&&(x.top=-8,b.top=-7),/^B/.test(a)&&(x.borderWidth="8px 8px 0 ",x.borderColor="rgba(0, 0, 0, 0.15) transparent transparent",b.borderWidth="7px 7px 0px",b.borderColor="#fff transparent transparent",a===de.BottonRight&&(x.top="100%",b.top="100%"),a===de.Botton&&(x.top="100%",b.top="100%"),a===de.BottonLeft&&(x.top="100%",b.top="100%")),/^(B|T)/.test(a)&&(a!==de.Top&&a!==de.Botton||(x.left="50%",x.marginLeft=-8,b.left="50%",b.marginLeft=-7),a!==de.TopRight&&a!==de.BottonRight||(x.right=10,b.right=11),a!==de.TopLeft&&a!==de.BottonLeft||(x.left=7,b.left=8)),/^L/.test(a)&&(x.borderWidth="8px 8px 8px 0px",x.borderColor="transparent rgba(0, 0, 0, 0.15) transparent transparent",b.borderWidth="7px 7px 7px 0px",b.borderColor="transparent #fff transparent transparent",x.left=-8,b.left=-7),/^R/.test(a)&&(x.borderWidth="8px 0px 8px 8px",x.borderColor="transparent transparent transparent rgba(0, 0, 0, 0.15)",b.borderWidth="7px 0px 7px 7px",b.borderColor="transparent transparent transparent #fff",x.right=-8,b.right=-7),/^(L|R)/.test(a)&&(a!==de.RightTop&&a!==de.LeftTop||(x.top=5,b.top=6),a!==de.Left&&a!==de.Right||(x.top="50%",b.top="50%",x.marginTop=-8,b.marginTop=-7),a!==de.LeftBotton&&a!==de.RightBotton||(x.top="100%",b.top="100%",x.marginTop=-21,b.marginTop=-20)),(0,q.jsx)(ae,e({ref:t,className:[o,s].filter(Boolean).join(" "),colors:d,color:u,rectRender:r=>{var{key:t}=r,o=z(r,le);return(0,q.jsx)(se,e({},o,{rectProps:p}),t)}},h,{onChange:e=>c&&c(I(e)),style:e({width:200,borderRadius:4,background:"#fff",boxShadow:"rgb(0 0 0 / 15%) 0px 3px 12px",border:"1px solid rgba(0, 0, 0, 0.2)",position:"relative",padding:5},l),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:b})]})}))}));pe.displayName="Github";const ce=pe;var he=e=>{var{className:r,color:t,left:o,top:a,prefixCls:s}=e,n={position:"absolute",top:a,left:o};return(0,O.useMemo)((()=>(0,q.jsx)("div",{className:s+"-pointer "+(r||""),style:n,children:(0,q.jsx)("div",{className:s+"-fill",style:{width:6,height:6,transform:"translate(-3px, -3px)",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:t}})})),[a,o,t,r,s])},ge=["prefixCls","radius","pointer","className","style","hsva","onChange"],ue=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-saturation",radius:a=0,pointer:s,className:n,style:l,hsva:i,onChange:d}=r,p=z(r,ge),c=e({width:200,height:200,borderRadius:a},l,{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)};return(0,q.jsx)(Z,e({className:[o,n||""].filter(Boolean).join(" ")},p,{style:e({position:"absolute",inset:0,cursor:"crosshair",backgroundImage:"linear-gradient(0deg, #000, transparent), linear-gradient(90deg, #fff, hsl("+i.h+", 100%, 50%))"},c),ref:t,onMove:h,onDown:h,children:_().createElement(s||he,e({prefixCls:o},g))}))}));ue.displayName="Saturation";const fe=ue;var xe=["prefixCls","className","hue","onChange","direction"],be=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-hue",className:a,hue:s=0,onChange:n,direction:l="horizontal"}=r,i=z(r,xe);return(0,q.jsx)(re,e({ref:t,className:o+" "+(a||"")},i,{direction:l,background:"linear-gradient(to "+("horizontal"===l?"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)=>{n&&n({h:"horizontal"===l?360*r.left:360*r.top})}}))}));be.displayName="Hue";const ve=be;var ye=["prefixCls","placement","label","value","className","style","labelStyle","inputStyle","onChange","onBlur"],me=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-editable-input",placement:a="bottom",label:s,value:n,className:l,style:i,labelStyle:d,inputStyle:p,onChange:c,onBlur:h}=r,g=z(r,ye),[u,f]=(0,O.useState)(n),x=(0,O.useRef)(!1);(0,O.useEffect)((()=>{r.value!==u&&(x.current||f(r.value))}),[r.value]);var b={};return"bottom"===a&&(b.flexDirection="column"),"top"===a&&(b.flexDirection="column-reverse"),"left"===a&&(b.flexDirection="row-reverse"),(0,q.jsxs)("div",{className:[o,l||""].filter(Boolean).join(" "),style:e({position:"relative",alignItems:"center",display:"flex",fontSize:11},b,i),children:[(0,q.jsx)("input",e({ref:t,value:u,onChange:function(e,r){var t=r||e.target.value;/^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(t)&&c&&c(e,t);var o=(e=>Number(String(e).replace(/%/g,"")))(t);isNaN(o)||c&&c(e,o),f(t)},onBlur:function(e){x.current=!1,f(r.value),h&&h(e)},autoComplete:"off",onFocus:()=>x.current=!0},g,{style:e({width:"100%",paddingTop:2,paddingBottom:2,paddingLeft:3,paddingRight:3,fontSize:11,boxSizing:"border-box",border:"none",boxShadow:"rgb(204 204 204) 0px 0px 0px 1px inset"},p)})),s&&(0,q.jsx)("span",{style:e({color:"rgb(153, 153, 153)",textTransform:"capitalize"},d),children:s})]})}));me.displayName="EditableInput";const Ce=me;var we=["prefixCls","hsva","placement","rProps","gProps","bProps","aProps","className","style","onChange"],je=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-editable-input-rgba",hsva:a,placement:s="bottom",rProps:n={},gProps:l={},bProps:i={},aProps:d={},className:c,style:h,onChange:g}=r,u=z(r,we),f=a?P(a):{};function x(e){var r=Number(e.target.value);r&&r>255&&(e.target.value="255"),r&&r<0&&(e.target.value="0")}var b=(r,t,o)=>{"number"===typeof r&&("a"===t&&(r<0&&(r=0),r>100&&(r=100),g&&g(I(p(e({},f,{a:r/100}))))),r>255&&(r=255,o.target.value="255"),r<0&&(r=0,o.target.value="0"),"r"===t&&g&&g(I(p(e({},f,{r:r})))),"g"===t&&g&&g(I(p(e({},f,{g:r})))),"b"===t&&g&&g(I(p(e({},f,{b:r})))))};return(0,q.jsxs)("div",e({ref:t,className:[o,c||""].filter(Boolean).join(" ")},u,{style:e({fontSize:11,display:"flex"},h),children:[(0,q.jsx)(Ce,e({label:"R",value:f.r||0,onBlur:x,placement:s,onChange:(e,r)=>b(r,"r",e)},n,{style:e({},n.style)})),(0,q.jsx)(Ce,e({label:"G",value:f.g||0,onBlur:x,placement:s,onChange:(e,r)=>b(r,"g",e)},l,{style:e({marginLeft:5},n.style)})),(0,q.jsx)(Ce,e({label:"B",value:f.b||0,onBlur:x,placement:s,onChange:(e,r)=>b(r,"b",e)},i,{style:e({marginLeft:5},i.style)})),d&&(0,q.jsx)(Ce,e({label:"A",value:f.a?parseInt(String(100*f.a),10):0,onBlur:x,placement:s,onChange:(e,r)=>b(r,"a",e)},d,{style:e({marginLeft:5},d.style)}))]}))}));je.displayName="EditableInputRGBA";const Re=je;var Se=["prefixCls","hsva","hProps","sProps","lProps","aProps","className","onChange"],Be=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-editable-input-hsla",hsva:a,hProps:s={},sProps:n={},lProps:l={},aProps:i={},className:d,onChange:p}=r,c=z(r,Se),h=a?y(a):{h:0,s:0,l:0,a:0},g=(r,t,o)=>{"number"===typeof r&&("h"===t&&(r<0&&(r=0),r>360&&(r=360),p&&p(I(v(e({},h,{h:r}))))),"s"===t&&(r<0&&(r=0),r>100&&(r=100),p&&p(I(v(e({},h,{s:r}))))),"l"===t&&(r<0&&(r=0),r>100&&(r=100),p&&p(I(v(e({},h,{l:r}))))),"a"===t&&(r<0&&(r=0),r>1&&(r=1),p&&p(I(v(e({},h,{a:r}))))))};return(0,q.jsx)(Re,e({ref:t,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)+"%"},n,{onChange:(e,r)=>g(r,"s")}),bProps:e({label:"L",value:Math.round(h.l)+"%"},l,{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:[o,d||""].filter(Boolean).join(" ")},c))}));Be.displayName="EditableInputHSLA";const Ne=Be;var Ae=["style"];function ke(r){var{style:t}=r,o=z(r,Ae),a=(0,O.useRef)(null),s=(0,O.useCallback)((()=>{a.current.style.backgroundColor="#e8e8e8"}),[]),n=(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},t)},o,{onMouseEnter:s,onMouseLeave:n,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:"#333"})})}))}var Pe=["prefixCls","className","style","color","inputType","rectProps","onChange"],Te=function(e){return e.HEXA="hexa",e.RGBA="rgba",e.HSLA="hsla",e}({}),Ee=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-chrome",className:a,style:s,color:l,inputType:i=Te.RGBA,rectProps:d={},onChange:p}=r,c=z(r,Pe),h="string"===typeof l&&n(l)?A(l):l||{h:0,s:0,l:0,a:0},g=e=>p&&p(I(e)),[u,f]=(0,O.useState)(i),x={paddingTop:6},b={textAlign:"center",paddingTop:4,paddingBottom:4};return(0,q.jsx)(ce,e({ref:t,color:h,style:e({borderRadius:0,flexDirection:"column",width:230,padding:0},s),colors:void 0,className:[o,a].filter(Boolean).join(" "),placement:de.TopLeft},c,{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)(re,{width:24,height:24,hsva:h,radius:2,style:{marginRight:15,borderRadius:"50%"},bgProps:{style:{background:"transparent"}},innerProps:{style:{borderRadius:"50%",background:E(h),boxShadow:"rgb(0 0 0 / 25%) 0px 0px 1px inset"}},pointer:()=>(0,q.jsx)(O.Fragment,{})}),(0,q.jsxs)("div",{style:{flex:1},children:[(0,q.jsx)(ve,{hue:h.h,style:{width:"100%"},bgProps:{style:{borderRadius:2}},onChange:r=>{g(e({},h,r))}}),(0,q.jsx)(re,{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==Te.RGBA&&(0,q.jsx)(Re,{hsva:h,rProps:{labelStyle:x,inputStyle:b},gProps:{labelStyle:x,inputStyle:b},bProps:{labelStyle:x,inputStyle:b},aProps:{labelStyle:x,inputStyle:b},onChange:e=>g(e.hsva)}),u===Te.HEXA&&(0,q.jsx)(Ce,{label:"HEX",labelStyle:x,inputStyle:b,value:h.a>0&&h.a<1?M(h).toLocaleUpperCase():D(h).toLocaleUpperCase(),onChange:(e,r)=>{"string"===typeof r&&g(A(/^#/.test(r)?r:"#"+r))}}),u===Te.HSLA&&(0,q.jsx)(Ne,{hsva:h,hProps:{labelStyle:x,inputStyle:b},sProps:{labelStyle:x,inputStyle:b},lProps:{labelStyle:x,inputStyle:b},aProps:{labelStyle:x,inputStyle:b},onChange:e=>g(e.hsva)})]}),(0,q.jsx)(ke,{onClick:()=>{u===Te.RGBA&&f(Te.HSLA),u===Te.HSLA&&f(Te.HEXA),u===Te.HEXA&&f(Te.RGBA)}})]})]}),rectRender:e=>{var{key:r}=e;return(0,q.jsx)(O.Fragment,{},r)}}))}));Ee.displayName="Chrome";const Le=Ee;var Fe=["prefixCls","className","style","color","colors","onChange"],De=["#D9E3F0","#F47373","#697689","#37D67A","#2CCCE4","#555555","#dce775","#ff8a65","#ba68c8"],Me=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-block",className:a,style:s,color:i,colors:d=De,onChange:p}=r,c=z(r,Fe),h="string"===typeof i&&n(i)?A(i):i,g=i?D(h):"",u=(e,r)=>{"string"===typeof e&&n(e)&&/(3|6)/.test(String(e.replace(/^#/,"").length))&&p&&p(I(A(e)))};return(0,q.jsxs)("div",e({ref:t,className:[o,a].filter(Boolean).join(" "),style:e({width:170,borderRadius:6,background:"rgb(255, 255, 255)",boxShadow:"rgb(0 0 0 / 10%) 0 1px",position:"relative"},s)},c,{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:l(g),height:110,fontSize:18,borderRadius:"6px 6px 0 0",display:"flex",alignItems:"center",justifyContent:"center"},children:g.toLocaleUpperCase()}),(0,q.jsx)(ae,{colors:d,color:g,style:{paddingLeft:10,paddingTop:10},rectProps:{style:{marginRight:10,marginBottom:10,borderRadius:4,height:22,width:22}},onChange:e=>{p&&p(I(e))}}),(0,q.jsx)(Ce,{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,color:"#666",padding:"0 7px"},style:{padding:10,paddingTop:0,borderRadius:"0 0 6px 6px"}})]}))}));Me.displayName="Block";const He=Me;var Ie=["prefixCls","className","style","onChange","color","colors"],ze=["#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 Oe(e){return e.checked?(0,q.jsx)("div",{style:{height:5,width:5,borderRadius:"50%",backgroundColor:l(e.color)}}):null}var _e=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-compact",className:a,style:s,onChange:l,color:i,colors:d=ze}=r,p=z(r,Ie),c="string"===typeof i&&n(i)?A(i):i,h=i?D(c).replace(/^#/,""):"",g=(0,O.useCallback)((e=>l&&l(I(e))),[]),u={style:{alignItems:"baseline"},inputStyle:{boxShadow:"none",backgroundColor:"transparent",outline:0}};return(0,q.jsxs)("div",e({ref:t,style:e({background:"#f6f6f6",borderRadius:3,display:"flex",width:240,flexWrap:"wrap",paddingTop:5,paddingLeft:5},s),className:[o,a||""].filter(Boolean).join(" ")},p,{children:[(0,q.jsx)(ae,{colors:d,color:i?D(c):void 0,rectProps:{children:(0,q.jsx)(Oe,{}),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)(Ce,{onChange:(e,r)=>{var t;"string"===typeof(t=r)&&n(t)&&/(3|6)/.test(String(t.length))&&g(A(t))},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:c,placement:"left",onChange:e=>g(e.hsva),aProps:!1,rProps:u,gProps:u,bProps:u})]})]}))}));_e.displayName="Compact";const We=_e;var Ge=["style","color"],Ue=["prefixCls","className","onChange","color","style","disableAlpha"],Xe=r=>{var{style:t,color:o}=r,a=z(r,Ge);return(0,q.jsx)("div",e({},a,{style:e({height:28,width:28,position:"absolute",transform:"translate(-14px, -4px)",boxShadow:"0 2px 4px rgb(0 0 0 / 20%)",borderRadius:"50%",background:"url("+K+")",backgroundColor:"#fff",border:"2px solid #fff",zIndex:1},t),children:(0,q.jsx)("div",{style:{backgroundColor:o,borderRadius:"50%",height:" 100%",width:"100%"}})}))},Ye=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-colorful",className:a,onChange:s,color:l,style:i,disableAlpha:d}=r,p=z(r,Ue),c="string"===typeof l&&n(l)?A(l):l||{},h=e=>s&&s(I(e));return(0,q.jsxs)("div",e({ref:t,style:e({width:200,position:"relative"},i)},p,{className:o+" "+(a||""),children:[(0,q.jsx)(fe,{hsva:c,className:o,radius:"8px 8px 0 0",style:{width:"auto",height:150,minWidth:120,borderBottom:"12px solid #000"},pointer:e=>{var{left:r,top:t,color:o}=e;return(0,q.jsx)(Xe,{style:{left:r,top:t,transform:"translate(-16px, -16px)"},color:D(c)})},onChange:r=>h(e({},c,r))}),(0,q.jsx)(ve,{hue:c.h,height:24,radius:d?"0 0 8px 8px":0,className:o,onChange:r=>h(e({},c,r)),pointer:e=>{var{left:r}=e;return(0,q.jsx)(Xe,{style:{left:r},color:"hsl("+(c.h||0)+"deg 100% 50%)"})}}),!d&&(0,q.jsx)(re,{hsva:c,height:24,className:o,radius:"0 0 8px 8px",pointer:e=>{var{left:r}=e;return(0,q.jsx)(Xe,{style:{left:r},color:E(c)})},onChange:r=>h(e({},c,r))})]}))}));Ye.displayName="Colorful";const qe=Ye;function Ve(r){var{style:t,title:o,checked:a,color:s,onClick:n,rectProps:l}=r,i=(0,O.useRef)(null),d=(0,O.useCallback)((()=>{i.current.style.transform="scale(1.2)"}),[]),p=(0,O.useCallback)((()=>{i.current.style.transform="scale(1)"}),[]);return(0,q.jsx)("div",{ref:i,onClick:n,onMouseEnter:d,onMouseLeave:p,title:o,style:e({},t,{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({},l,{style:e({height:a?"100%":0,width:a?"100%":0,borderRadius:"50%",backgroundColor:"#fff",boxSizing:"border-box",transition:"height 100ms ease 0s, width 100ms ease 0s"},l.style)}))})}var Qe=["prefixCls","className","color","colors","rectProps","onChange"],Ze=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-circle",className:a,color:s,colors:l=[],rectProps:i={},onChange:d}=r,p=z(r,Qe),c="string"===typeof s&&n(s)?A(s):s||{},h=s?D(c):"";return(0,q.jsx)(ae,e({ref:t,colors:l,color:h},p,{className:[o,a].filter(Boolean).join(" "),rectRender:r=>{var t=e({},(function(e){if(null==e)throw new TypeError("Cannot destructure "+e)}(r),r));return(0,q.jsx)(Ve,e({},t,{rectProps:i}))},onChange:e=>{d&&d(I(e))}}))}));Ze.displayName="Circle";const $e=Ze;var Je=["prefixCls","className","style","color","onChange"],Ke={boxShadow:"initial",borderWidth:"0 0 1px 0",borderBottomColor:"#eee",borderBottomStyle:"solid",height:30,outline:0,fontSize:15,padding:0},er=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-material",className:a,style:s,color:l,onChange:i}=r,d=z(r,Je),p="string"===typeof l&&n(l)?A(l):l,c=l?D(p).replace(/^#/,""):"",h=(e,r)=>{"string"===typeof e&&n(e)&&/(3|6)/.test(String(e.length))&&i&&i(I(A(e)))};return(0,q.jsxs)("div",e({ref:t,className:[o,a||""].filter(Boolean).join(" "),style:e({padding:16,width:98,fontFamily:"Roboto",backgroundColor:"#fff"},s)},d,{children:[(0,q.jsx)(Ce,{label:"Hex",value:c.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:c?"#"+c:"#eee",borderBottomStyle:"solid"},style:{flexDirection:"column-reverse",alignItems:"flex-start"}}),(0,q.jsx)(Re,{hsva:p,placement:"top",style:{marginTop:11},rProps:{style:{alignItems:"flex-start"},inputStyle:e({},Ke)},gProps:{style:{alignItems:"flex-start"},inputStyle:e({},Ke)},bProps:{style:{alignItems:"flex-start"},inputStyle:e({},Ke)},aProps:!1,onChange:e=>{return r=e.hsva,void(i&&i(I(r)));var r}})]}))}));er.displayName="Material";const rr=er;var tr=["prefixCls","className","onChange","direction","hsva"],or=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-saturation",className:a,onChange:s,direction:n="horizontal",hsva:l}=r,i=z(r,tr),d=u(e({},l,{a:1,v:100}));return(0,q.jsx)(re,e({ref:t},i,{className:o+" "+(a||""),hsva:{h:l.h,s:l.s,v:l.v,a:1-l.v/100},direction:n,background:"linear-gradient(to "+("horizontal"===n?"right":"bottom")+", "+d+", rgb(0, 0, 0))",onChange:(e,r)=>{s&&s({v:"horizontal"===n?100-100*r.left:100-100*r.top})}}))}));or.displayName="ShadeSlider";const ar=or;var sr=["prefixCls","className","style","onChange","color","lightness"],nr=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-slider",className:a,style:s,onChange:l,color:i,lightness:d=[80,65,50,35,20]}=r,p=z(r,sr),h="string"===typeof i&&n(i)?A(i):i||{};return(0,q.jsx)("div",e({ref:t,style:e({display:"flex"},s),className:[o,a||""].filter(Boolean).join(" ")},p,{children:d.map(((r,t)=>{var o="hsl("+y(h).h+", 50%, "+r+"%)",a=o===c(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)=>{l&&l(I(b(e)),r)})(o,e),style:e({backgroundColor:o,height:12,cursor:"pointer"},a?{borderRadius:2,transform:"scale(1, 1.5)"}:{})})},t)}))}))}));nr.displayName="Slider";const lr=nr;var ir=["prefixCls","className","onChange","width","presetColors","color","editableDisable","disableAlpha","style"],dr=["#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"}}),cr=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-sketch",className:a,onChange:s,width:l=218,presetColors:i=dr,color:d,editableDisable:p=!0,disableAlpha:c=!1,style:h}=r,g=z(r,ir),[u,f]=(0,O.useState)({h:209,s:36,v:90,a:1});(0,O.useEffect)((()=>{"string"===typeof d&&n(d)&&f(A(d)),"object"===typeof d&&f(d)}),[d]);var x=e=>{f(e),s&&s(I(e))};return(0,q.jsxs)("div",e({},g,{className:o+" "+(a||""),ref:t,style:e({background:"rgb(255, 255, 255)",borderRadius:4,boxShadow:"rgb(0 0 0 / 15%) 0px 0px 0px 1px, rgb(0 0 0 / 15%) 0px 8px 16px",width:l},h),children:[(0,q.jsxs)("div",{style:{padding:"10px 10px 8px"},children:[(0,q.jsx)(fe,{hsva:u,style:{width:"auto",height:150},onChange:r=>x(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)(ve,{width:"auto",height:10,hue:u.h,pointer:pr,innerProps:{style:{marginLeft:1,marginRight:5}},onChange:r=>x(e({},u,r))}),!c&&(0,q.jsx)(re,{width:"auto",height:10,hsva:u,pointer:pr,style:{marginTop:4},innerProps:{style:{marginLeft:1,marginRight:5}},onChange:r=>x(e({},u,{a:r.a}))})]}),!c&&(0,q.jsx)(re,{width:24,height:24,hsva:u,radius:2,style:{marginLeft:4},bgProps:{style:{background:"transparent"}},innerProps:{style:{borderRadius:2,background:E(u),boxShadow:"rgb(0 0 0 / 15%) 0px 0px 0px 1px inset, rgb(0 0 0 / 25%) 0px 0px 4px inset"}},pointer:()=>(0,q.jsx)(O.Fragment,{})})]})]}),p&&(0,q.jsxs)("div",{style:{display:"flex",margin:"0 10px 3px 10px"},children:[(0,q.jsx)(Ce,{label:"Hex",value:D(u).replace(/^#/,"").toLocaleUpperCase(),onChange:(e,r)=>{var t;"string"===typeof(t=r)&&n(t)&&/(3|6)/.test(String(t.length))&&x(A(t))},style:{minWidth:58}}),(0,q.jsx)(Re,{hsva:u,style:{marginLeft:6},aProps:!c&&{},onChange:e=>x(e.hsva)})]}),i&&i.length>0&&(0,q.jsx)(ae,{style:{borderTop:"1px solid rgb(238, 238, 238)",paddingTop:10,paddingLeft:10},colors:i,color:D(u),onChange:e=>x(e),rectProps:{style:{marginRight:10,marginBottom:10,borderRadius:3,boxShadow:"rgb(0 0 0 / 15%) 0px 0px 0px 1px inset"}}})]}))}));cr.displayName="Sketch";const hr=cr;var gr=r=>{var{className:t,color:o,left:a,top:s,style:n,prefixCls:l}=r,i=e({},n,{position:"absolute",top:s,left:a}),d=l+"-pointer "+(t||"");return(0,q.jsx)("div",{className:d,style:i,children:(0,q.jsx)("div",{className:l+"-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:o}})})})},ur=2*Math.PI,fr=(e,r)=>(e%r+r)%r,xr=(e,r)=>Math.sqrt(e*e+r*r);function br(e){var{width:r=0}=e,t=r/2;return{width:r,radius:t,cx:t,cy:t}}function vr(e){var{width:r=0}=e;return r/2}function yr(e,r,t){var o=e.angle||0,a=e.direction;return t&&"clockwise"===a?r=o+r:"clockwise"===a?r=360-o+r:t&&"anticlockwise"===a?r=o+180-r:"anticlockwise"===a&&(r=o-r),fr(r,360)}var mr=["prefixCls","radius","pointer","className","style","width","height","direction","angle","color","onChange"],Cr=_().forwardRef(((r,t)=>{var{prefixCls:o="w-color-wheel",radius:a=0,pointer:s,className:l,style:i,width:d=200,height:p=200,direction:c="anticlockwise",angle:h=180,color:g,onChange:u}=r,f=z(r,mr),x="string"===typeof g&&n(g)?A(g):g||{},b=g?D(x):"",v=function(e,r){var{cx:t,cy:o}=br(e),a=vr(e),s=(180+yr(e,r.h,!0))*(ur/360),n=r.s/100*a,l="clockwise"===e.direction?-1:1;return{x:t+n*Math.cos(s)*l,y:o+n*Math.sin(s)*l}}({width:d},x),y={top:"0",left:"0",color:b},m=(e,r)=>{var t=function(e,r,t){var{cx:o,cy:a}=br(e),s=vr(e);r=o-r,t=a-t;var n=yr(e,Math.atan2(-t,-r)*(360/ur)),l=Math.min(xr(r,t),s);return{h:Math.round(n),s:Math.round(100/s*l)}}({width:d},d-e.x,p-e.y),o={h:t.h,s:t.s,v:x.v,a:x.a};u&&u(I(o))};return(0,q.jsxs)(Z,e({className:[o,l||""].filter(Boolean).join(" ")},f,{style:e({position:"relative",width:d,height:p},i),ref:t,onMove:m,onDown:m,children:[_().createElement(s||gr,e({prefixCls:o,style:{zIndex:1,transform:"translate("+v.x+"px, "+v.y+"px)"}},y)),(0,q.jsx)("div",{style:{position:"absolute",borderRadius:"50%",background:"anticlockwise"===c?"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 x.v?1-x.v/100:0}})]}))}));Cr.displayName="Wheel";const wr=Cr})(),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:()=>re,BACKGROUND_IMG:()=>K,Block:()=>He,Chrome:()=>Le,ChromeInputType:()=>Te,Circle:()=>$e,Colorful:()=>qe,Compact:()=>We,EditableInput:()=>Ce,EditableInputHSLA:()=>Be,EditableInputRGBA:()=>je,Github:()=>pe,GithubPlacement:()=>de,Hue:()=>ve,Material:()=>rr,Pointer:()=>$,Saturation:()=>be,ShadeSlider:()=>ar,Sketch:()=>hr,Slider:()=>nr,Swatch:()=>ae,Wheel:()=>wr,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:()=>k,hsvaStringToHsva:()=>m,hsvaToHex:()=>D,hsvaToHexa:()=>M,hsvaToHslString:()=>p,hsvaToHsla:()=>y,hsvaToHslaString:()=>u,hsvaToHsv:()=>H,hsvaToHsvString:()=>h,hsvaToHsvaString:()=>g,hsvaToRgbString:()=>T,hsvaToRgba:()=>P,hsvaToRgbaString:()=>E,parseHue:()=>w,rgbStringToHsva:()=>R,rgbaStringToHsva:()=>j,rgbaToHex:()=>S,rgbaToHexa:()=>B,rgbaToHsva:()=>c,rgbaToRgb:()=>L,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)},k=m,j=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=j,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+")"},E=e=>{var{r:r,g:o,b:t,a:a}=P(e);return"rgba("+r+", "+o+", "+t+", "+a+")"},L=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=L(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 $=e=>{var{className:r,prefixCls:o,left:t,top:a}=e,s={position:"absolute",left:t,top:a},l={width:18,height:18,transform:t?"translate(-9px, -1px)":"translate(-1px, -9px)",boxShadow:"var(--alpha-pointer-box-shadow)",borderRadius:"50%",backgroundColor:"var(--alpha-pointer-background-color)"};return(0,O.useMemo)((()=>(0,q.jsx)("div",{className:o+"-pointer "+(r||""),style:s,children:(0,q.jsx)("div",{className:o+"-fill",style:l})})),[r,t,a,o])},J=["prefixCls","className","hsva","background","bgProps","innerProps","radius","width","height","direction","style","onChange","pointer"],K="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==",ee=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-alpha",className:a,hsva:s,background:l,bgProps:n={},innerProps:i={},radius:d=0,width:c,height:p=16,direction:h="horizontal",style:g,onChange:b,pointer:f}=r,x=z(r,J),v=r=>{b&&b(e({},s,{a:"horizontal"===h?r.left:r.top}),r)},y=u(Object.assign({},s,{a:1})),m="linear-gradient(to "+("horizontal"===h?"right":"bottom")+", rgba(244, 67, 54, 0) 0%, "+y+" 100%)",C={};"horizontal"===h?C.left=100*s.a+"%":C.top=100*s.a+"%";var w=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:d,background:"url("+K+") left center",backgroundColor:"var(--alpha-background-color)"},g,{position:"relative"},{width:c,height:p});return(0,q.jsxs)("div",e({},x,{className:[t,t+"-"+h,a||""].filter(Boolean).join(" "),style:w,ref:o,children:[(0,q.jsx)("div",e({},n,{style:e({inset:0,position:"absolute",background:l||m,borderRadius:d},n.style)})),(0,q.jsx)(Z,e({},i,{style:e({},i.style,{inset:0,zIndex:1,position:"absolute"}),onMove:v,onDown:v,children:_().createElement(f||$,e({prefixCls:t},C))}))]}))}));ee.displayName="Aplha";const re=ee;var oe=["prefixCls","className","color","colors","style","rectProps","onChange","addonAfter","addonBefore","rectRender"],te=_().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,oe),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]}))}));te.displayName="Swatch";const ae=te;function se(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 le=["prefixCls","placement","className","style","color","colors","rectProps","onChange"],ne=["key"],ie=["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],de=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}({}),ce=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-github",placement:a=de.TopRight,className:s,style:n,color:i,colors:d=ie,rectProps:c={},onChange:p}=r,h=z(r,le),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===de.TopRight&&(x.top=-8,v.top=-7),a===de.Top&&(x.top=-8,v.top=-7),a===de.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===de.BottonRight&&(x.top="100%",v.top="100%"),a===de.Botton&&(x.top="100%",v.top="100%"),a===de.BottonLeft&&(x.top="100%",v.top="100%")),/^(B|T)/.test(a)&&(a!==de.Top&&a!==de.Botton||(x.left="50%",x.marginLeft=-8,v.left="50%",v.marginLeft=-7),a!==de.TopRight&&a!==de.BottonRight||(x.right=10,v.right=11),a!==de.TopLeft&&a!==de.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!==de.RightTop&&a!==de.LeftTop||(x.top=5,v.top=6),a!==de.Left&&a!==de.Right||(x.top="50%",v.top="50%",x.marginTop=-8,v.marginTop=-7),a!==de.LeftBotton&&a!==de.RightBotton||(x.top="100%",v.top="100%",x.marginTop=-21,v.marginTop=-20)),(0,q.jsx)(ae,e({ref:o,className:[t,s].filter(Boolean).join(" "),colors:d,color:u,rectRender:r=>{var{key:o}=r,t=z(r,ne);return(0,q.jsx)(se,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})]})}))}));ce.displayName="Github";const pe=ce;var he=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"],ue=_().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})},g={top:100-i.v+"%",left:i.s+"%",color:u(i)};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:_().createElement(s||he,e({prefixCls:t},g))}))}));ue.displayName="Saturation";const be=ue;var fe=["prefixCls","className","hue","onChange","direction"],xe=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-hue",className:a,hue:s=0,onChange:l,direction:n="horizontal"}=r,i=z(r,fe);return(0,q.jsx)(re,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})}}))}));xe.displayName="Hue";const ve=xe;var ye=["prefixCls","placement","label","value","className","style","labelStyle","inputStyle","onChange","onBlur"],me=_().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,ye),[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})]})}));me.displayName="EditableInput";const Ce=me;var we=["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,we),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)(Ce,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)(Ce,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)(Ce,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)(Ce,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 je=ke;var Re=["prefixCls","hsva","hProps","sProps","lProps","aProps","className","onChange"],Se=_().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,Re),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)(je,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))}));Se.displayName="EditableInputHSLA";const Be=Se;var Ne=["style"];function Ae(r){var{style:o}=r,t=z(r,Ne),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 Pe=["prefixCls","className","style","color","inputType","rectProps","onChange"],Te=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=Te.RGBA,rectProps:d={},onChange:c}=r,p=z(r,Pe),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:E(h),boxShadow:"var(--chrome-alpha-box-shadow)"};return(0,q.jsx)(pe,e({ref:o,color:h,style:v,colors:void 0,className:[t,a].filter(Boolean).join(" "),placement:de.TopLeft},p,{addonAfter:(0,q.jsxs)(O.Fragment,{children:[(0,q.jsx)(be,{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)(re,{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)(ve,{hue:h.h,style:{width:"100%"},bgProps:{style:{borderRadius:2}},onChange:r=>{g(e({},h,r))}}),(0,q.jsx)(re,{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==Te.RGBA&&(0,q.jsx)(je,{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===Te.HEXA&&(0,q.jsx)(Ce,{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===Te.HSLA&&(0,q.jsx)(Be,{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)(Ae,{onClick:()=>{u===Te.RGBA&&b(Te.HSLA),u===Te.HSLA&&b(Te.HEXA),u===Te.HEXA&&b(Te.RGBA)}})]})]}),rectRender:e=>{var{key:r}=e;return(0,q.jsx)(O.Fragment,{},r)}}))}));Ee.displayName="Chrome";const Le=Ee;var Fe=["prefixCls","className","style","color","colors","onChange"],De=["#D9E3F0","#F47373","#697689","#37D67A","#2CCCE4","#555555","#dce775","#ff8a65","#ba68c8"],Me=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-block",className:a,style:s,color:i,colors:d=De,onChange:c}=r,p=z(r,Fe),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)(ae,{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)(Ce,{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"}})]}))}));Me.displayName="Block";const He=Me;var Ie=["prefixCls","className","style","onChange","color","colors"],ze=["#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 Oe(e){return e.checked?(0,q.jsx)("div",{style:{height:5,width:5,borderRadius:"50%",backgroundColor:n(e.color)}}):null}var _e=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-compact",className:a,style:s,onChange:n,color:i,colors:d=ze}=r,c=z(r,Ie),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)(ae,{colors:d,color:i?D(p):void 0,rectProps:{children:(0,q.jsx)(Oe,{}),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)(Ce,{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)(je,{hsva:p,placement:"left",onChange:e=>g(e.hsva),aProps:!1,rProps:u,gProps:u,bProps:u})]})]}))}));_e.displayName="Compact";const We=_e;var Ge=["style","color"],Ue=["prefixCls","className","onChange","color","style","disableAlpha"],Xe=r=>{var{style:o,color:t}=r,a=z(r,Ge),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("+K+")",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%"}})}))},Ye=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-colorful",className:a,onChange:s,color:n,style:i,disableAlpha:d}=r,c=z(r,Ue),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)(be,{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)(Xe,{style:{left:r,top:o,transform:"translate(-16px, -16px)"},color:D(p)})},onChange:r=>h(e({},p,r))}),(0,q.jsx)(ve,{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)(Xe,{style:{left:r},color:"hsl("+(p.h||0)+"deg 100% 50%)"})}}),!d&&(0,q.jsx)(re,{hsva:p,height:24,className:t,radius:"0 0 8px 8px",pointer:e=>{var{left:r}=e;return(0,q.jsx)(Xe,{style:{left:r},color:E(p)})},onChange:r=>h(e({},p,r))})]}))}));Ye.displayName="Colorful";const qe=Ye;function Ve(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 Qe=["prefixCls","className","color","colors","rectProps","onChange"],Ze=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-circle",className:a,color:s,colors:n=[],rectProps:i={},onChange:d}=r,c=z(r,Qe),p="string"===typeof s&&l(s)?N(s):s||{},h=s?D(p):"";return(0,q.jsx)(ae,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)(Ve,e({},o,{rectProps:i}))},onChange:e=>{d&&d(I(e))}}))}));Ze.displayName="Circle";const $e=Ze;var Je=["prefixCls","className","style","color","onChange"],Ke={boxShadow:"initial",borderWidth:"0 0 1px 0",borderBottomColor:"var(--material-border-bottom-color)",borderBottomStyle:"solid",height:30,outline:0,fontSize:15,padding:0},er=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-material",className:a,style:s,color:n,onChange:i}=r,d=z(r,Je),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)(Ce,{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)(je,{hsva:c,placement:"top",style:{marginTop:11},rProps:{style:{alignItems:"flex-start"},inputStyle:e({},Ke)},gProps:{style:{alignItems:"flex-start"},inputStyle:e({},Ke)},bProps:{style:{alignItems:"flex-start"},inputStyle:e({},Ke)},aProps:!1,onChange:e=>{return r=e.hsva,void(i&&i(I(r)));var r}})]}))}));er.displayName="Material";const rr=er;var or=["prefixCls","className","onChange","direction","hsva"],tr=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-saturation",className:a,onChange:s,direction:l="horizontal",hsva:n}=r,i=z(r,or),d=u(e({},n,{a:1,v:100}));return(0,q.jsx)(re,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})}}))}));tr.displayName="ShadeSlider";const ar=tr;var sr=["prefixCls","className","style","onChange","color","lightness"],lr=_().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,sr),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)}))}))}));lr.displayName="Slider";const nr=lr;var ir=["prefixCls","className","onChange","width","presetColors","color","editableDisable","disableAlpha","style"],dr=["#D0021B","#F5A623","#f8e61b","#8B572A","#7ED321","#417505","#BD10E0","#9013FE","#4A90E2","#50E3C2","#B8E986","#000000","#4A4A4A","#9B9B9B","#FFFFFF"],cr=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"}}),pr=_().forwardRef(((r,o)=>{var{prefixCls:t="w-color-sketch",className:a,onChange:s,width:n=218,presetColors:i=dr,color:d,editableDisable:c=!0,disableAlpha:p=!1,style:h}=r,g=z(r,ir),[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:E(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)(be,{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)(ve,{width:"auto",height:10,hue:u.h,pointer:cr,innerProps:{style:{marginLeft:1,marginRight:5}},onChange:r=>f(e({},u,r))}),!p&&(0,q.jsx)(re,{width:"auto",height:10,hsva:u,pointer:cr,style:{marginTop:4},innerProps:{style:{marginLeft:1,marginRight:5}},onChange:r=>f(e({},u,{a:r.a}))})]}),!p&&(0,q.jsx)(re,{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)(Ce,{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)(je,{hsva:u,style:{marginLeft:6},aProps:!p&&{},onChange:e=>f(e.hsva)})]}),i&&i.length>0&&(0,q.jsx)(ae,{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)"}}})]}))}));pr.displayName="Sketch";const hr=pr;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}})})})},ur=2*Math.PI,br=(e,r)=>(e%r+r)%r,fr=(e,r)=>Math.sqrt(e*e+r*r);function xr(e){var{width:r=0}=e,o=r/2;return{width:r,radius:o,cx:o,cy:o}}function vr(e){var{width:r=0}=e;return r/2}function yr(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),br(r,360)}var mr=["prefixCls","radius","pointer","className","style","width","height","direction","angle","color","onChange"],Cr=_().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,mr),f="string"===typeof g&&l(g)?N(g):g||{},x=g?D(f):"",v=function(e,r){var{cx:o,cy:t}=xr(e),a=vr(e),s=(180+yr(e,r.h,!0))*(ur/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}=xr(e),s=vr(e);r=t-r,o=a-o;var l=yr(e,Math.atan2(-o,-r)*(360/ur)),n=Math.min(fr(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))};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:[_().createElement(s||gr,e({prefixCls:t,style:{zIndex:1,transform:"translate("+v.x+"px, "+v.y+"px)"}},y)),(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}})]}))}));Cr.displayName="Wheel";const wr=Cr})(),a})())); |
{ | ||
"name": "@uiw/react-color", | ||
"version": "1.2.4", | ||
"version": "1.3.0", | ||
"description": "Color Picker component for React.", | ||
@@ -50,21 +50,21 @@ "homepage": "https://uiwjs.github.io/react-color", | ||
"dependencies": { | ||
"@uiw/color-convert": "1.2.4", | ||
"@uiw/react-color-alpha": "1.2.4", | ||
"@uiw/react-color-block": "1.2.4", | ||
"@uiw/react-color-chrome": "1.2.4", | ||
"@uiw/react-color-circle": "1.2.4", | ||
"@uiw/react-color-colorful": "1.2.4", | ||
"@uiw/react-color-compact": "1.2.4", | ||
"@uiw/react-color-editable-input": "1.2.4", | ||
"@uiw/react-color-editable-input-hsla": "1.2.4", | ||
"@uiw/react-color-editable-input-rgba": "1.2.4", | ||
"@uiw/react-color-github": "1.2.4", | ||
"@uiw/react-color-hue": "1.2.4", | ||
"@uiw/react-color-material": "1.2.4", | ||
"@uiw/react-color-saturation": "1.2.4", | ||
"@uiw/react-color-shade-slider": "1.2.4", | ||
"@uiw/react-color-sketch": "1.2.4", | ||
"@uiw/react-color-slider": "1.2.4", | ||
"@uiw/react-color-swatch": "1.2.4", | ||
"@uiw/react-color-wheel": "1.2.4" | ||
"@uiw/color-convert": "1.3.0", | ||
"@uiw/react-color-alpha": "1.3.0", | ||
"@uiw/react-color-block": "1.3.0", | ||
"@uiw/react-color-chrome": "1.3.0", | ||
"@uiw/react-color-circle": "1.3.0", | ||
"@uiw/react-color-colorful": "1.3.0", | ||
"@uiw/react-color-compact": "1.3.0", | ||
"@uiw/react-color-editable-input": "1.3.0", | ||
"@uiw/react-color-editable-input-hsla": "1.3.0", | ||
"@uiw/react-color-editable-input-rgba": "1.3.0", | ||
"@uiw/react-color-github": "1.3.0", | ||
"@uiw/react-color-hue": "1.3.0", | ||
"@uiw/react-color-material": "1.3.0", | ||
"@uiw/react-color-saturation": "1.3.0", | ||
"@uiw/react-color-shade-slider": "1.3.0", | ||
"@uiw/react-color-sketch": "1.3.0", | ||
"@uiw/react-color-slider": "1.3.0", | ||
"@uiw/react-color-swatch": "1.3.0", | ||
"@uiw/react-color-wheel": "1.3.0" | ||
}, | ||
@@ -71,0 +71,0 @@ "devDependencies": { |
@@ -75,2 +75,46 @@ <!--rehype:ignore:start--> | ||
## Support dark/night Theme | ||
```css | ||
[data-color-mode*='dark'] .w-color-sketch { | ||
--sketch-background: #323232 !important; | ||
} | ||
[data-color-mode*='dark'] .w-color-swatch { | ||
--sketch-swatch-border-top: 1px solid #525252 !important; | ||
} | ||
[data-color-mode*='dark'] .w-color-block { | ||
--block-background-color: #323232 !important; | ||
--block-box-shadow: rgb(0 0 0 / 10%) 0 1px !important; | ||
} | ||
[data-color-mode*='dark'] .w-color-editable-input { | ||
--editable-input-label-color: #757575 !important; | ||
--editable-input-box-shadow: #616161 0px 0px 0px 1px inset !important; | ||
--editable-input-color: #bbb !important; | ||
} | ||
[data-color-mode*='dark'] .w-color-github { | ||
--github-border: 1px solid rgba(0, 0, 0, 0.2) !important; | ||
--github-background-color: #323232 !important; | ||
--github-box-shadow: rgb(0 0 0 / 15%) 0px 3px 12px !important; | ||
--github-arrow-border-color: rgba(0, 0, 0, 0.15) !important; | ||
} | ||
[data-color-mode*='dark'] .w-color-compact { | ||
--compact-background-color: #323232 !important; | ||
} | ||
[data-color-mode*='dark'] .w-color-material { | ||
--material-background-color: #323232 !important; | ||
--material-border-bottom-color: #707070 !important; | ||
} | ||
[data-color-mode*='dark'] .w-color-alpha { | ||
--alpha-pointer-background-color: #6a6a6a !important; | ||
--alpha-pointer-box-shadow: rgb(0 0 0 / 37%) 0px 1px 4px 0px !important; | ||
} | ||
``` | ||
## Packages | ||
@@ -77,0 +121,0 @@ |
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
176114
3322
172
+ Added@uiw/color-convert@1.3.0(transitive)
+ Added@uiw/react-color-alpha@1.3.0(transitive)
+ Added@uiw/react-color-block@1.3.0(transitive)
+ Added@uiw/react-color-chrome@1.3.0(transitive)
+ Added@uiw/react-color-circle@1.3.0(transitive)
+ Added@uiw/react-color-colorful@1.3.0(transitive)
+ Added@uiw/react-color-compact@1.3.0(transitive)
+ Added@uiw/react-color-editable-input@1.3.0(transitive)
+ Added@uiw/react-color-editable-input-hsla@1.3.0(transitive)
+ Added@uiw/react-color-editable-input-rgba@1.3.0(transitive)
+ Added@uiw/react-color-github@1.3.0(transitive)
+ Added@uiw/react-color-hue@1.3.0(transitive)
+ Added@uiw/react-color-material@1.3.0(transitive)
+ Added@uiw/react-color-saturation@1.3.0(transitive)
+ Added@uiw/react-color-shade-slider@1.3.0(transitive)
+ Added@uiw/react-color-sketch@1.3.0(transitive)
+ Added@uiw/react-color-slider@1.3.0(transitive)
+ Added@uiw/react-color-swatch@1.3.0(transitive)
+ Added@uiw/react-color-wheel@1.3.0(transitive)
+ Added@uiw/react-drag-event-interactive@1.3.0(transitive)
- Removed@uiw/color-convert@1.2.4(transitive)
- Removed@uiw/react-color-alpha@1.2.4(transitive)
- Removed@uiw/react-color-block@1.2.4(transitive)
- Removed@uiw/react-color-chrome@1.2.4(transitive)
- Removed@uiw/react-color-circle@1.2.4(transitive)
- Removed@uiw/react-color-colorful@1.2.4(transitive)
- Removed@uiw/react-color-compact@1.2.4(transitive)
- Removed@uiw/react-color-editable-input@1.2.4(transitive)
- Removed@uiw/react-color-editable-input-hsla@1.2.4(transitive)
- Removed@uiw/react-color-editable-input-rgba@1.2.4(transitive)
- Removed@uiw/react-color-github@1.2.4(transitive)
- Removed@uiw/react-color-hue@1.2.4(transitive)
- Removed@uiw/react-color-material@1.2.4(transitive)
- Removed@uiw/react-color-saturation@1.2.4(transitive)
- Removed@uiw/react-color-shade-slider@1.2.4(transitive)
- Removed@uiw/react-color-sketch@1.2.4(transitive)
- Removed@uiw/react-color-slider@1.2.4(transitive)
- Removed@uiw/react-color-swatch@1.2.4(transitive)
- Removed@uiw/react-color-wheel@1.2.4(transitive)
- Removed@uiw/react-drag-event-interactive@1.2.4(transitive)
Updated@uiw/color-convert@1.3.0
Updated@uiw/react-color-alpha@1.3.0
Updated@uiw/react-color-block@1.3.0
Updated@uiw/react-color-hue@1.3.0
Updated@uiw/react-color-wheel@1.3.0