@corva/ui 0.36.0-16 → 0.36.0-17
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
|
-
import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/objectWithoutProperties";import{forwardRef as r}from"react";import i from"classnames";import a from"prop-types";import{Grid as o,Tooltip as l,Typography as s,Switch as c,withStyles as n}from"@material-ui/core";import b from"./style.css.js";import{jsxs as
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/objectWithoutProperties";import{forwardRef as r}from"react";import i from"classnames";import a from"prop-types";import{Grid as o,Tooltip as l,Typography as s,Switch as c,withStyles as n}from"@material-ui/core";import b from"./style.css.js";import{jsxs as p,jsx as d}from"react/jsx-runtime";var m=["root","track","switchBase"];function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function f(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?h(Object(i),!0).forEach((function(r){e(t,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):h(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}var u=r((function(r,a){var n,h,u=r.title,g=r.leftLabel,y=r.rightLabel,L=r.checked,w=r.onChange,D=r.disabled,k=r.classes,O=r.size,v=r.className,j=r.rightLabelTooltip,C=r.leftLabelTooltip,B=r.customClasses,N=g&&y,P=B.root,x=B.track,S=B.switchBase,T=t(B,m);return p("div",{className:v,children:[u&&d("div",{className:b.switchControlTitle,children:u}),p(o,{component:"label",container:!0,alignItems:"center",spacing:0,children:[g&&d(o,{item:!0,children:d(l,{title:C,children:d(s,{variant:"body2",className:i(k.label,"small"===O&&k.labelSmall,(!L||!y)&&!D&&k.activeLabel,D&&k.disabledLabel),children:g})})}),d(o,{item:!0,children:d(c,{ref:a,checked:L,onChange:w,color:"primary",disabled:D,classes:f({root:i(k.root,P),switchBase:i((n={},e(n,k.switchBase,N||L&&!D),e(n,k.switchBaseDisabled,D&&(N||L)),e(n,k.switchBaseDisabledNoLabels,!N&&D&&!L),n),S),track:i((h={},e(h,k.track,N||L&&!D),e(h,k.trackDisabled,D&&(N||L)),e(h,k.trackDisabledNoLabels,!N&&D&&!L),h),x)},T),size:O})}),y&&d(o,{item:!0,children:d(l,{title:j,children:d(s,{variant:"body2",className:i(k.label,"small"===O&&k.labelSmall,(L||!g)&&!D&&k.activeLabel,D&&k.disabledLabel),children:y})})})]})]})}));u.propTypes={title:a.string,leftLabel:a.string,rightLabel:a.string,checked:a.bool.isRequired,onChange:a.func.isRequired,disabled:a.bool,classes:a.shape({}).isRequired,size:a.string,className:a.string,customClasses:a.shape(),rightLabelTooltip:a.string,leftLabelTooltip:a.string},u.defaultProps={title:"",leftLabel:"",rightLabel:"",disabled:!1,size:"medium",className:"",customClasses:{},rightLabelTooltip:"",leftLabelTooltip:""};var g=n({root:{width:60,height:40,padding:13,"&.MuiSwitch-sizeSmall":{width:52,height:36,padding:13},"& .MuiSwitch-switchBase":{padding:10}},switchBase:{padding:10,color:"#03BCD4","&.MuiIconButton-root:hover":{backgroundColor:"rgba(3, 188, 212, 0.08)"}},switchBaseDisabled:{color:"#196069 !important"},track:{backgroundColor:"#196069 !important",opacity:"1 !important",border:"none"},trackDisabled:{backgroundColor:"#223D40 !important",opacity:"1 !important",border:"none"},switchBaseDisabledNoLabels:{color:"#545454 !important"},trackDisabledNoLabels:{backgroundColor:"#3D3D3D !important",opacity:"1 !important",border:"none"},label:{display:"flex",justifyContent:"center",flexDirection:"column",fontSize:"16px",lineHeight:"22px",color:"#9e9e9e",margin:"8px 0px",cursor:"pointer"},labelSmall:{fontSize:"14px",lineHeight:"20px"},disabledLabel:{cursor:"default",color:"#808080"},activeLabel:{color:"#ffffff"}})(u);export{u as SwitchControlComponent,g as default};
|