@corva/ui 0.77.0-16 → 0.77.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
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),a=require("react"),r=require("@material-ui/core"),i=require("classnames"),o=require("lodash"),l=require("react/jsx-runtime");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=n(e),u=n(t),p=n(i),h=o.debounce((function(e){e()}),500),m=r.makeStyles((function(e){var t=e.isLightTheme,a=e.palette;return{root:{position:"absolute","&:hover":{borderColor:a.primary.main},"&:active":{borderColor:a.primary.main},"&:hover $handle":{background:a.primary.dark,borderColor:a.primary.main},"&:hover $minimalHandle":{background:a.primary.main},"&:active $minimalHandle":{background:a.primary.main},"&:active $handle":{background:a.primary.dark,borderColor:a.primary.main},display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},horizontalHeadRoot:{top:0,bottom:0,right:5,borderRight:"2px solid #414141"},horizontalTailRoot:{top:0,bottom:0,left:5,borderLeft:"2px solid #414141"},verticalHeadRoot:{left:0,right:0,bottom:5,borderBottom:"2px solid #414141"},verticalTailRoot:{left:0,right:0,top:5,borderTop:"2px solid #414141"},handle:{background:t?"#B1B1B1":"#414141",border:"1px solid transparent","& > p":{fontSize:"11px",textAlign:"center",lineHeight:"16px"},display:"flex",alignItems:"center",justifyContent:"center",padding:"1px"},horizontalHeadHandle:{width:"40px",height:"16px",borderTopLeftRadius:"2px",borderBottomLeftRadius:"2px"},horizontalTailHandle:{width:"40px",height:"16px",borderTopRightRadius:"2px",borderBottomRightRadius:"2px"},verticalHeadHandle:{width:"80%",maxWidth:"40px",height:"16px",borderTopLeftRadius:"2px",borderTopRightRadius:"2px"},verticalTailHandle:{width:"80%",maxWidth:"40px",height:"16px",borderBottomLeftRadius:"2px",borderBottomRightRadius:"2px"},inputRoot:{height:"100%",fontSize:"11px","&::before":{borderWidth:0},"&::after":{borderWidth:"1px !important"},"& .MuiInputBase-input":{padding:0,height:"100%",textAlign:"center"},"&:hover::before":{borderWidth:"1px !important"}},minimalHandle:{background:a.primary.text9,width:8,height:18,"& .MuiInput-underline.Mui-error:after":{border:0}},minimalVerticalHandle:{width:18,height:8},minimalHandleRoot:{borderColor:a.primary.text9,zIndex:100,"&:not(:hover)":{border:"none"}}}}));exports.Handle=function(e){var t,i,o=e.value,n=e.orientation,s=e.placement,c=e.readOnly,f=e.onChange,b=e.min,x=e.max,g=e.displayFormatter,v=e.classes,R=e.minimal,H=e["data-testid"],y=m(),z=a.useState(o),T=u.default(z,2),k=T[0],B=T[1],C=a.useRef(null);a.useEffect((function(){B(o)}),[o]);return l.jsx("div",{className:p.default(y.root,v.handleRoot,(t={},d.default(t,y.horizontalHeadRoot,"horizontal"===n&&"head"===s),d.default(t,y.horizontalTailRoot,"horizontal"===n&&"tail"===s),d.default(t,y.verticalHeadRoot,"vertical"===n&&"head"===s),d.default(t,y.verticalTailRoot,"vertical"===n&&"tail"===s),d.default(t,y.minimalHandleRoot,R),t)),children:l.jsx("div",{className:p.default(y.handle,v.handle,(i={},d.default(i,y.horizontalHeadHandle,"horizontal"===n&&"head"===s),d.default(i,y.horizontalTailHandle,"horizontal"===n&&"tail"===s),d.default(i,y.verticalHeadHandle,"vertical"===n&&"head"===s),d.default(i,y.verticalTailHandle,"vertical"===n&&"tail"===s),d.default(i,y.minimalHandle,R),d.default(i,y.minimalVerticalHandle,R&&"vertical"===n),i)),"data-testid":H,children:!R&&l.jsx(r.Input,{inputProps:{"data-testid":"handle-input"},readOnly:c,inputRef:C,classes:{root:y.inputRoot},value:c?g(k):k,onChange:function(e){var t=e.target.value;B(t),Number.isFinite(+t)&&+t>=b&&+t<=x&&h((function(){f(+t)}))},error:!(Number.isFinite(+k)&&+k>=b&&+k<=x)})})})};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function Handle({ value, orientation, placement, readOnly, onChange, min, max, displayFormatter, classes, minimal, }: {
|
|
1
|
+
export function Handle({ value, orientation, placement, readOnly, onChange, min, max, displayFormatter, classes, minimal, "data-testid": dataTestId, }: {
|
|
2
2
|
value: any;
|
|
3
3
|
orientation: any;
|
|
4
4
|
placement: any;
|
|
@@ -9,5 +9,6 @@ export function Handle({ value, orientation, placement, readOnly, onChange, min,
|
|
|
9
9
|
displayFormatter: any;
|
|
10
10
|
classes: any;
|
|
11
11
|
minimal: any;
|
|
12
|
+
"data-testid": any;
|
|
12
13
|
}): JSX.Element;
|
|
13
14
|
//# sourceMappingURL=Handle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Handle.d.ts","sourceRoot":"","sources":["../../../src/components/AdvancedSlider/Handle.js"],"names":[],"mappings":"AAqBO
|
|
1
|
+
{"version":3,"file":"Handle.d.ts","sourceRoot":"","sources":["../../../src/components/AdvancedSlider/Handle.js"],"names":[],"mappings":"AAqBO;;;;;;;;;;;;gBAqEN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import{useState as r,useRef as i,useEffect as o}from"react";import{makeStyles as a,Input as n}from"@material-ui/core";import l from"classnames";import{debounce as d}from"lodash";import{jsx as m}from"react/jsx-runtime";var p=d((function(t){t()}),500),h=function(a){var d,h,s=a.value,u=a.orientation,b=a.placement,x=a.readOnly,f=a.onChange,g=a.min,v=a.max,R=a.displayFormatter,H=a.classes,y=a.minimal,z=a["data-testid"],T=c(),B=r(s),C=e(B,2),k=C[0],w=C[1],L=i(null);o((function(){w(s)}),[s]);return m("div",{className:l(T.root,H.handleRoot,(d={},t(d,T.horizontalHeadRoot,"horizontal"===u&&"head"===b),t(d,T.horizontalTailRoot,"horizontal"===u&&"tail"===b),t(d,T.verticalHeadRoot,"vertical"===u&&"head"===b),t(d,T.verticalTailRoot,"vertical"===u&&"tail"===b),t(d,T.minimalHandleRoot,y),d)),children:m("div",{className:l(T.handle,H.handle,(h={},t(h,T.horizontalHeadHandle,"horizontal"===u&&"head"===b),t(h,T.horizontalTailHandle,"horizontal"===u&&"tail"===b),t(h,T.verticalHeadHandle,"vertical"===u&&"head"===b),t(h,T.verticalTailHandle,"vertical"===u&&"tail"===b),t(h,T.minimalHandle,y),t(h,T.minimalVerticalHandle,y&&"vertical"===u),h)),"data-testid":z,children:!y&&m(n,{inputProps:{"data-testid":"handle-input"},readOnly:x,inputRef:L,classes:{root:T.inputRoot},value:x?R(k):k,onChange:function(t){var e=t.target.value;w(e),Number.isFinite(+e)&&+e>=g&&+e<=v&&p((function(){f(+e)}))},error:!(Number.isFinite(+k)&&+k>=g&&+k<=v)})})})},c=a((function(t){var e=t.isLightTheme,r=t.palette;return{root:{position:"absolute","&:hover":{borderColor:r.primary.main},"&:active":{borderColor:r.primary.main},"&:hover $handle":{background:r.primary.dark,borderColor:r.primary.main},"&:hover $minimalHandle":{background:r.primary.main},"&:active $minimalHandle":{background:r.primary.main},"&:active $handle":{background:r.primary.dark,borderColor:r.primary.main},display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},horizontalHeadRoot:{top:0,bottom:0,right:5,borderRight:"2px solid #414141"},horizontalTailRoot:{top:0,bottom:0,left:5,borderLeft:"2px solid #414141"},verticalHeadRoot:{left:0,right:0,bottom:5,borderBottom:"2px solid #414141"},verticalTailRoot:{left:0,right:0,top:5,borderTop:"2px solid #414141"},handle:{background:e?"#B1B1B1":"#414141",border:"1px solid transparent","& > p":{fontSize:"11px",textAlign:"center",lineHeight:"16px"},display:"flex",alignItems:"center",justifyContent:"center",padding:"1px"},horizontalHeadHandle:{width:"40px",height:"16px",borderTopLeftRadius:"2px",borderBottomLeftRadius:"2px"},horizontalTailHandle:{width:"40px",height:"16px",borderTopRightRadius:"2px",borderBottomRightRadius:"2px"},verticalHeadHandle:{width:"80%",maxWidth:"40px",height:"16px",borderTopLeftRadius:"2px",borderTopRightRadius:"2px"},verticalTailHandle:{width:"80%",maxWidth:"40px",height:"16px",borderBottomLeftRadius:"2px",borderBottomRightRadius:"2px"},inputRoot:{height:"100%",fontSize:"11px","&::before":{borderWidth:0},"&::after":{borderWidth:"1px !important"},"& .MuiInputBase-input":{padding:0,height:"100%",textAlign:"center"},"&:hover::before":{borderWidth:"1px !important"}},minimalHandle:{background:r.primary.text9,width:8,height:18,"& .MuiInput-underline.Mui-error:after":{border:0}},minimalVerticalHandle:{width:18,height:8},minimalHandleRoot:{borderColor:r.primary.text9,zIndex:100,"&:not(:hover)":{border:"none"}}}}));export{h as Handle};
|