@corva/ui 0.60.0-14 → 0.60.0-15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require('./../../ext-esm/tslib/tslib.es6.js'),t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";var e=require('./../../ext-esm/tslib/tslib.es6.js'),t=require("react/jsx-runtime"),r=require("react"),o=require("prop-types"),a=require("@material-ui/core"),n=require("@material-ui/icons"),i=require("chroma-js"),l=require("classnames"),s=require("validate-color"),c=require("./PaletteChromePicker/PaletteChromePicker.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=u(o),d=u(i),f=u(l),b=u(s),g={rgba:function(e){return"rgba(".concat(e.rgb.r,", ").concat(e.rgb.g,", ").concat(e.rgb.b,", ").concat(e.rgb.a,")")},rgb:function(e){return"rgb(".concat(e.rgb.r,", ").concat(e.rgb.g,", ").concat(e.rgb.b,")")},hex:function(e){return e.hex},rgba_rgb:function(e){return 1===e.rgb.a?g.rgb(e):g.rgba(e)},rgba_hex:function(e){return 1===e.rgb.a?g.hex(e):g.rgba(e)}},h=function(o){var i,l,s,c=o.label,u=o.value,p=o.converter,h=o.onChange,m=o.buttonClassName,x=o.popoverAnchorOrigin,v=o.popoverTransformOrigin,C=o.labelPosition,L=o.hideLabel,P=o.pickerComponent,T=o.classes,k=o.lensColor,y=o.enableTransparencyPalette,_=o["data-testid"],O=o.tooltipProps,j=r.useState(null),q=j[0],R=j[1],S=r.useState("#03BCD4"),z=S[0],I=S[1],w=r.useRef();r.useEffect((function(){var e=null==u?void 0:u.trim();e&&b.default(e)?I(e):console.error("The color value(".concat(u,") is not valid, please check it."))}),[u]);return t.jsxs("div",e.__assign({className:f.default(T.root,(i={},i[T.topLabelRoot]="top"===C,i[T.rightLabelRoot]="right"===C,i))},{children:[!L&&t.jsx(a.InputLabel,e.__assign({className:f.default((l={},l[T.topLabel]="top"===C,l[T.rightLabel]="right"===C,l)),shrink:!0},{children:c})),t.jsx(a.Tooltip,e.__assign({title:O.title},O,{children:t.jsx(a.IconButton,e.__assign({"data-testid":"".concat(_,"_icon_").concat(c),className:f.default(T.button,m,(s={},s[T.buttonTransparrent]=0===d.default(z).alpha(),s)),disableRipple:!0,style:{backgroundColor:z,color:k},onClick:function(e){R(e.currentTarget)}},{children:t.jsx(n.ColorLens,{fontSize:"small",className:T.colorLensIcon})}))})),t.jsx(a.Popover,e.__assign({id:"colors-popper",action:w,open:Boolean(q),anchorEl:q,onClose:function(){R(null)},anchorOrigin:x,transformOrigin:v},{children:t.jsx(P,{color:z,onChange:function(e){var t=g[p](e);I(t),h(t)},onSizeChange:function(){w.current&&w.current.updatePosition()},enableTransparencyPalette:y})}))]}))},m=p.default.shape({vertical:p.default.oneOfType([p.default.oneOf(["top","center","bottom"]),p.default.number]),horizontal:p.default.oneOfType([p.default.oneOf(["left","center","right"]),p.default.number])}),x={buttonClassName:p.default.string,label:p.default.string,value:p.default.string.isRequired,onChange:p.default.func.isRequired,converter:p.default.oneOf(Object.keys(g)),classes:p.default.shape({button:p.default.string.isRequired,root:p.default.string,topLabelRoot:p.default.string,rightLabelRoot:p.default.string,topLabel:p.default.string,rightLabel:p.default.string,buttonTransparrent:p.default.string,colorLensIcon:p.default.string}).isRequired,pickerComponent:p.default.elementType,labelPosition:p.default.oneOf(["top","right"]),popoverAnchorOrigin:m,popoverTransformOrigin:m,tooltipProps:p.default.shape({title:p.default.string}),hideLabel:p.default.bool,lensColor:p.default.string,enableTransparencyPalette:p.default.bool,"data-testid":p.default.string};h.propTypes=x,h.defaultProps={label:"Color",buttonClassName:null,converter:"rgba_hex",pickerComponent:c,hideLabel:!1,popoverAnchorOrigin:{vertical:"bottom",horizontal:"left"},popoverTransformOrigin:{vertical:"top",horizontal:"left"},tooltipProps:{title:"Change color"},labelPosition:"top",lensColor:"#fff",enableTransparencyPalette:!1,"data-testid":"ColorPicker"};var v=a.withStyles({root:{position:"relative",display:"flex"},topLabelRoot:{flexDirection:"column"},rightLabelRoot:{flexDirection:"row-reverse",justifyContent:"flex-end",alignItems:"center"},button:{width:"36px",height:"24px",boxShadow:"0px 3px 6px rgba(0, 0, 0, 0.161)",borderRadius:"5px"},buttonTransparrent:{position:"relative",backgroundImage:"url(".concat("/static/media/39f55985e0da1489ad22264208b0493d.svg",")"),backgroundSize:"cover",backgroundPosition:"center","&::before":{content:'""',position:"absolute",display:"block",width:"100%",height:"3px",background:"#FF0000",transform:"rotate(148deg)",borderRadius:"2px"}},colorLensIcon:{position:"relative",zIndex:2},popper:{zIndex:1500},topLabel:{marginBottom:"8px",fontSize:"15px",lineHeight:"17px",letterSpacing:"0.4px",color:"#BDBDBD",whiteSpace:"nowrap"},rightLabel:{marginLeft:"8px",fontSize:"16px"}})(h);module.exports=v;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__assign as o}from'./../../ext-esm/tslib/tslib.es6.js';import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useState as t,useRef as n,useEffect as
|
|
1
|
+
import{__assign as o}from'./../../ext-esm/tslib/tslib.es6.js';import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useState as t,useRef as n,useEffect as a}from"react";import i from"prop-types";import{withStyles as l,InputLabel as c,Tooltip as s,IconButton as p,Popover as b}from"@material-ui/core";import{ColorLens as g}from"@material-ui/icons";import u from"chroma-js";import m from"classnames";import h from"validate-color";import d from"./PaletteChromePicker/PaletteChromePicker.js";var f={rgba:function(o){return"rgba(".concat(o.rgb.r,", ").concat(o.rgb.g,", ").concat(o.rgb.b,", ").concat(o.rgb.a,")")},rgb:function(o){return"rgb(".concat(o.rgb.r,", ").concat(o.rgb.g,", ").concat(o.rgb.b,")")},hex:function(o){return o.hex},rgba_rgb:function(o){return 1===o.rgb.a?f.rgb(o):f.rgba(o)},rgba_hex:function(o){return 1===o.rgb.a?f.hex(o):f.rgba(o)}},v=function(i){var l,d,v,x=i.label,C=i.value,L=i.converter,P=i.onChange,k=i.buttonClassName,T=i.popoverAnchorOrigin,O=i.popoverTransformOrigin,y=i.labelPosition,R=i.hideLabel,z=i.pickerComponent,S=i.classes,I=i.lensColor,N=i.enableTransparencyPalette,j=i["data-testid"],w=i.tooltipProps,B=t(null),D=B[0],_=B[1],q=t("#03BCD4"),A=q[0],F=q[1],E=n();a((function(){var o=null==C?void 0:C.trim();o&&h(o)?F(o):console.error("The color value(".concat(C,") is not valid, please check it."))}),[C]);return e("div",o({className:m(S.root,(l={},l[S.topLabelRoot]="top"===y,l[S.rightLabelRoot]="right"===y,l))},{children:[!R&&r(c,o({className:m((d={},d[S.topLabel]="top"===y,d[S.rightLabel]="right"===y,d)),shrink:!0},{children:x})),r(s,o({title:w.title},w,{children:r(p,o({"data-testid":"".concat(j,"_icon_").concat(x),className:m(S.button,k,(v={},v[S.buttonTransparrent]=0===u(A).alpha(),v)),disableRipple:!0,style:{backgroundColor:A,color:I},onClick:function(o){_(o.currentTarget)}},{children:r(g,{fontSize:"small",className:S.colorLensIcon})}))})),r(b,o({id:"colors-popper",action:E,open:Boolean(D),anchorEl:D,onClose:function(){_(null)},anchorOrigin:T,transformOrigin:O},{children:r(z,{color:A,onChange:function(o){var e=f[L](o);F(e),P(e)},onSizeChange:function(){E.current&&E.current.updatePosition()},enableTransparencyPalette:N})}))]}))},x=i.shape({vertical:i.oneOfType([i.oneOf(["top","center","bottom"]),i.number]),horizontal:i.oneOfType([i.oneOf(["left","center","right"]),i.number])}),C={buttonClassName:i.string,label:i.string,value:i.string.isRequired,onChange:i.func.isRequired,converter:i.oneOf(Object.keys(f)),classes:i.shape({button:i.string.isRequired,root:i.string,topLabelRoot:i.string,rightLabelRoot:i.string,topLabel:i.string,rightLabel:i.string,buttonTransparrent:i.string,colorLensIcon:i.string}).isRequired,pickerComponent:i.elementType,labelPosition:i.oneOf(["top","right"]),popoverAnchorOrigin:x,popoverTransformOrigin:x,tooltipProps:i.shape({title:i.string}),hideLabel:i.bool,lensColor:i.string,enableTransparencyPalette:i.bool,"data-testid":i.string};v.propTypes=C,v.defaultProps={label:"Color",buttonClassName:null,converter:"rgba_hex",pickerComponent:d,hideLabel:!1,popoverAnchorOrigin:{vertical:"bottom",horizontal:"left"},popoverTransformOrigin:{vertical:"top",horizontal:"left"},tooltipProps:{title:"Change color"},labelPosition:"top",lensColor:"#fff",enableTransparencyPalette:!1,"data-testid":"ColorPicker"};var L=l({root:{position:"relative",display:"flex"},topLabelRoot:{flexDirection:"column"},rightLabelRoot:{flexDirection:"row-reverse",justifyContent:"flex-end",alignItems:"center"},button:{width:"36px",height:"24px",boxShadow:"0px 3px 6px rgba(0, 0, 0, 0.161)",borderRadius:"5px"},buttonTransparrent:{position:"relative",backgroundImage:"url(".concat("/static/media/39f55985e0da1489ad22264208b0493d.svg",")"),backgroundSize:"cover",backgroundPosition:"center","&::before":{content:'""',position:"absolute",display:"block",width:"100%",height:"3px",background:"#FF0000",transform:"rotate(148deg)",borderRadius:"2px"}},colorLensIcon:{position:"relative",zIndex:2},popper:{zIndex:1500},topLabel:{marginBottom:"8px",fontSize:"15px",lineHeight:"17px",letterSpacing:"0.4px",color:"#BDBDBD",whiteSpace:"nowrap"},rightLabel:{marginLeft:"8px",fontSize:"16px"}})(v);export{L as default};
|