@corva/ui 0.28.0-10 → 0.28.0-11
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{jsxs as
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import{jsxs as t,jsx as r}from"react/jsx-runtime";import{withStyles as a,Grid as i,Typography as o,Switch as l}from"@material-ui/core";import{forwardRef as s}from"react";import c from"@babel/runtime/helpers/objectWithoutProperties";import n from"prop-types";import b from"classnames";import d from"./style.css.js";function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function m(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?p(Object(a),!0).forEach((function(r){e(t,r,a[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):p(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}var h=s((function(a,s){var n,p,h=a.title,f=a.leftLabel,u=a.rightLabel,g=a.checked,y=a.onChange,w=a.disabled,D=a.classes,k=a.size,O=a.className,L=a.customClasses,j=f&&u,v=L.root,C=L.track,B=L.switchBase,N=c(L,["root","track","switchBase"]);return t("div",{className:O,children:[h&&r("div",{className:d.switchControlTitle,children:h}),t(i,{component:"label",container:!0,alignItems:"center",spacing:0,children:[f&&r(i,{item:!0,children:r(o,{variant:"body2",className:b(D.label,"small"===k&&D.labelSmall,!g&&!w&&D.activeLabel,w&&D.disabledLabel),children:f})}),r(i,{item:!0,children:r(l,{ref:s,checked:g,onChange:y,color:"primary",disabled:w,classes:m({root:b(D.root,v),switchBase:b((n={},e(n,D.switchBase,j||g&&!w),e(n,D.switchBaseDisabled,w&&(j||g)),e(n,D.switchBaseDisabledNoLabels,!j&&w&&!g),n),B),track:b((p={},e(p,D.track,j||g&&!w),e(p,D.trackDisabled,w&&(j||g)),e(p,D.trackDisabledNoLabels,!j&&w&&!g),p),C)},N),size:k})}),u&&r(i,{item:!0,children:r(o,{variant:"body2",className:b(D.label,"small"===k&&D.labelSmall,g&&!w&&D.activeLabel,w&&D.disabledLabel),children:u})})]})]})}));h.propTypes={title:n.string,leftLabel:n.string,rightLabel:n.string,checked:n.bool.isRequired,onChange:n.func.isRequired,disabled:n.bool,classes:n.shape({}).isRequired,size:n.string,className:n.string,customClasses:n.shape()},h.defaultProps={title:"",leftLabel:"",rightLabel:"",disabled:!1,size:"medium",className:"",customClasses:{}};var f=a({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:"#bdbdbd",margin:"8px 0px",cursor:"pointer"},labelSmall:{fontSize:"14px",lineHeight:"20px"},disabledLabel:{cursor:"default",color:"#616161"},activeLabel:{color:"#ffffff"}})(h);export default f;
|