@corva/ui 0.81.0-12 → 0.81.0-13

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"),i=require("react"),o=require("@material-ui/core"),n=require("re-resizable"),r=require("react-sizeme"),a=require("classnames"),l=require("lodash"),d=require("../shared/useThrottledCallback.js"),s=require("./Handle.js"),h=require("react/jsx-runtime");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=u(e),m=u(t),f=u(a);function v(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,o)}return i}function p(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?v(Object(i),!0).forEach((function(t){c.default(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):v(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var g="twoValuesSliderDefault",b=function(e){var t,o,r=e.min,a=e.max,l=e.value,u=e.size,v=e.orientation,b=e.valueFormatter,y=e.displayFormatter,j=e.editableHandles,z=e.onChange,H=e.onStop,B=e.reversed,C=e.handlePosition,L=e.handleClasses,O=e.minimal,k=x(),R=i.useRef(null),F=i.useRef(null),S=i.useState([b(null==l?void 0:l.at(0)),b(null==l?void 0:l.at(1))]),P=m.default(S,2),E=P[0],M=P[1],q=i.useRef(null),D=i.useState(!1),T=m.default(D,2),I=T[0],_=T[1];i.useEffect((function(){if(!q.current){var e=[b(null==l?void 0:l.at(0)),b(null==l?void 0:l.at(1))],t=Math.min.apply(Math,e),i=Math.max.apply(Math,e);M([t,i])}}),[null==l?void 0:l.at(0),null==l?void 0:l.at(1)]);var N=m.default(E,2),W=N[0],A=N[1];i.useEffect((function(){if("horizontal"===v){var e=u.width/(a-r)*(W-r),t=u.width/(a-r)*(a-A);R.current.updateSize({width:B?t:e,height:u.height}),F.current.updateSize({width:B?e:t,height:u.height})}else if("vertical"===v){var i=u.height/(a-r)*(W-r),o=u.height/(a-r)*(a-A);R.current.updateSize({width:u.width,height:B?o:i}),F.current.updateSize({width:u.width,height:B?i:o})}}),[r,a,W,A,u.width,u.height,v]),i.useEffect((function(){var e=function(){document.removeEventListener("mousemove",V),document.removeEventListener("mouseup",G),document.removeEventListener("touchmove",J),document.removeEventListener("touchend",K)};return I?(document.addEventListener("mousemove",V),document.addEventListener("mouseup",G),document.addEventListener("touchmove",J),document.addEventListener("touchend",K)):(e(),H()),function(){e()}}),[I]);var $=d.useThrottledCallback((function(e,t,i){q.current="onResize Event";var o=i.clientWidth,n=i.clientHeight,l=W,d=A;"right"===t?B?d=b(a-o/u.width*(a-r)):l=b(r+o/u.width*(a-r)):"left"===t?B?l=b(r+o/u.width*(a-r)):d=b(a-o/u.width*(a-r)):"bottom"===t?B?d=b(a-n/u.height*(a-r)):l=b(r+n/u.height*(a-r)):"top"===t&&(B?l=b(r+n/u.height*(a-r)):d=b(a-n/u.height*(a-r))),l=Math.min(l,A),d=Math.max(d,W),M([l,d]),z([l,d])})),X=d.useThrottledCallback((function(){q.current=null,H()})),Y=function(e,t){q.current={xPos:e,yPos:t,head:W,tail:A}},Z=function(e,t){if(q.current){var i;"horizontal"===v?i=(q.current.xPos-e)/u.width*(a-r):"vertical"===v&&(i=(q.current.yPos-t)/u.height*(a-r));var o,n,l=q.current.head-i*(B?-1:1),d=q.current.tail-i*(B?-1:1),s=q.current.tail-q.current.head;l<=r?(o=r,n=r+s):d>=a?(o=a-s,n=a):(o=l,n=d),o=b(o),n=b(n),M([o,n]),z([o,n])}},V=d.useThrottledCallback((function(e){Z(e.clientX,e.clientY)})),G=d.useThrottledCallback((function(){q.current=null,_(!1)})),J=d.useThrottledCallback((function(e){Z(e.touches[0].pageX,e.touches[0].pageY)})),K=d.useThrottledCallback((function(){q.current=null,_(!1)})),Q=d.useThrottledCallback((function(e){M([e,A]),z([e,A])})),U=d.useThrottledCallback((function(e){M([W,e]),z([W,e])})),ee=i.useMemo((function(){return(A-W)/(a-r)*("vertical"===v?u.height:u.width)<30}),[r,a,W,A]),te=function(e){var t={min:r,max:A,value:W,onChange:Q},i={min:W,max:a,value:A,onChange:U};return"head"===e?h.jsx(s.Handle,p({"data-testid":"".concat(g,"_handle_top"),placement:"head",readOnly:!j,displayFormatter:y,orientation:v,classes:L,minimal:O},B?i:t)):"tail"===e?h.jsx(s.Handle,p({"data-testid":"".concat(g,"_handle_bottom"),placement:"tail",readOnly:!j,displayFormatter:y,orientation:v,classes:L,minimal:O},B?t:i)):null};return h.jsx("div",{className:k.rootWrapper,children:h.jsxs("div",{className:f.default(k.root,(t={},c.default(t,k.horizontalRoot,"horizontal"===v),c.default(t,k.verticalRoot,"vertical"===v),c.default(t,k.minimal,O),t)),children:[h.jsx(n.Resizable,{ref:R,minHeight:0,minWidth:0,enable:{right:"horizontal"===v,bottom:"vertical"===v},handleComponent:{right:te("head"),bottom:te("head")},onResize:$,onResizeStop:X}),h.jsx("div",{className:k.body,"data-testid":"slider-body",onMouseDown:function(e){Y(e.clientX,e.clientY),_(!0)},onTouchStart:function(e){Y(e.touches[0].pageX,e.touches[0].pageY),_(!0)},children:ee?h.jsx("div",{className:f.default((o={},c.default(o,k.horizontalBodyHandle,"horizontal"===v),c.default(o,k.verticalBodyHandle,"vertical"===v),c.default(o,k.leftBodyHandle,"left"===C),c.default(o,k.rightBodyHandle,"right"===C),c.default(o,k.topBodyHandle,"top"===C),c.default(o,k.bottomBodyHandle,"bottom"===C),o)),children:h.jsx("div",{className:k.bodyHandle,"data-testid":"".concat(g,"_handle"),children:h.jsx(w,{orientation:"vertical",minimal:O})})}):h.jsx("div",{className:k.bodyHandleIcon,"data-testid":"".concat(g,"_handle"),children:h.jsx(w,{orientation:v,minimal:O})})}),h.jsx(n.Resizable,{ref:F,minHeight:0,minWidth:0,enable:{left:"horizontal"===v,top:"vertical"===v},handleComponent:{left:te("tail"),top:te("tail")},onResize:$,onResizeStop:X})]})})};b.defaultProps={orientation:"horizontal",valueFormatter:Math.floor,displayFormatter:function(e){return e},onChange:l.noop,onStop:l.noop,reversed:!1,editableHandles:!0,handleClasses:{},minimal:!1};var y=r.withSize({monitorWidth:!0,monitorHeight:!0})(b),w=function(e){var t=e.orientation;return e.minimal?"horizontal"===t?h.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"20",viewBox:"0 -2 16 16",fill:"none",children:h.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.33333 4L4 4L4 12L5.33333 12L5.33333 4ZM8.66659 4L8.66659 12L7.33325 12L7.33325 4L8.66659 4ZM12.0001 4L12.0001 12L10.6667 12L10.6667 4L12.0001 4Z",fill:"white"})}):h.jsxs("svg",{width:"12",height:"7",viewBox:"0 0 12 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("rect",{width:"12",height:"1"}),h.jsx("rect",{y:"3",width:"12",height:"1"}),h.jsx("rect",{y:"6",width:"12",height:"1"})]}):"horizontal"===t?h.jsxs("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("rect",{x:"7.5",y:"0.5",width:"12",height:"1",transform:"rotate(90 7.5 0.5)"}),h.jsx("rect",{x:"4.5",y:"0.5",width:"12",height:"1",transform:"rotate(90 4.5 0.5)"}),h.jsx("rect",{x:"1.5",y:"0.5",width:"12",height:"1",transform:"rotate(90 1.5 0.5)"})]}):h.jsxs("svg",{width:"12",height:"7",viewBox:"0 0 12 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("rect",{width:"12",height:"1"}),h.jsx("rect",{y:"3",width:"12",height:"1"}),h.jsx("rect",{y:"6",width:"12",height:"1"})]})},x=o.makeStyles((function(e){return{rootWrapper:{position:"relative",width:"100%",height:"100%",zIndex:100},root:{position:"absolute",width:"100%",height:"100%",zIndex:100,"&:hover:not($minimal) $body":{background:"#008BA366"},"&:hover $bodyHandle":{visibility:"visible"}},horizontalRoot:{display:"flex",alignItems:"center"},verticalRoot:{display:"flex",alignItems:"center",flexDirection:"column"},body:{position:"relative",flex:1,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none",background:"#3B3B3B66",color:"#BDBDBD","& svg":{fill:"currentColor"},"&:hover":{cursor:"grab",background:"#008BA366",color:"#FFFFFF"},"&:active":{cursor:"grabbing"},"&:hover $bodyHandleIcon":{visibility:"visible"}},horizontalBodyHandle:{position:"absolute",bottom:-24},verticalBodyHandle:{position:"absolute",left:-24},leftBodyHandle:{position:"absolute",left:-24,right:"auto"},rightBodyHandle:{position:"absolute",right:-24,left:"auto"},topBodyHandle:{position:"absolute",top:-24,bottom:"auto"},bottomBodyHandle:{position:"absolute",bottom:-24,top:"auto"},bodyHandle:{width:24,height:24,borderRadius:"50%",background:"#03BCD4",color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",visibility:"hidden"},bodyHandleIcon:{visibility:"hidden"},minimal:{border:"1px solid ".concat(e.palette.background.b9),borderRadius:4,"& $body":{"&:hover":{background:"#008BA366"},margin:-1,width:"calc(100% + 2px)",height:"calc(100% + 2px)",backgroundColor:o.fade(e.palette.background.b7,.1),border:"1px solid ".concat(e.palette.primary.text9),borderRadius:4}}}}));exports.AdvancedSlider=b,exports.default=y;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/slicedToArray"),n=require("react"),a=require("re-resizable"),r=require("react-sizeme"),i=require("classnames"),o=require("lodash"),l=require("../shared/useThrottledCallback.js"),d=require("./Handle.js"),u=require("./icons/HandleIcon.js"),s=require("./styles/sliderStyles.js");require("./styles/handleStyles.js");var c=require("react/jsx-runtime");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=h(e),f=h(t),v=h(i);function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach((function(t){m.default(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var y="twoValuesSliderDefault",g=function(e){var t,r,i=e.min,o=e.max,h=e.value,p=e.size,g=e.orientation,j=e.valueFormatter,w=e.displayFormatter,z=e.editableHandles,x=e.onChange,H=e.onStop,O=e.reversed,S=e.handlePosition,C=e.handleClasses,P=e.minimal,E=s.useSliderStyles(),q=n.useRef(null),R=n.useRef(null),T=n.useState([j(null==h?void 0:h.at(0)),j(null==h?void 0:h.at(1))]),k=f.default(T,2),M=k[0],L=k[1],_=n.useRef(null),B=n.useState(!1),D=f.default(B,2),F=D[0],N=D[1];n.useEffect((function(){if(!_.current){var e=[j(null==h?void 0:h.at(0)),j(null==h?void 0:h.at(1))],t=Math.min.apply(Math,e),n=Math.max.apply(Math,e);L([t,n])}}),[null==h?void 0:h.at(0),null==h?void 0:h.at(1)]);var W=f.default(M,2),I=W[0],X=W[1];n.useEffect((function(){if("horizontal"===g){var e=p.width/(o-i)*(I-i),t=p.width/(o-i)*(o-X);q.current.updateSize({width:O?t:e,height:p.height}),R.current.updateSize({width:O?e:t,height:p.height})}else if("vertical"===g){var n=p.height/(o-i)*(I-i),a=p.height/(o-i)*(o-X);q.current.updateSize({width:p.width,height:O?a:n}),R.current.updateSize({width:p.width,height:O?n:a})}}),[i,o,I,X,p.width,p.height,g]),n.useEffect((function(){var e=function(){document.removeEventListener("mousemove",J),document.removeEventListener("mouseup",K),document.removeEventListener("touchmove",Q),document.removeEventListener("touchend",U)};return F?(document.addEventListener("mousemove",J),document.addEventListener("mouseup",K),document.addEventListener("touchmove",Q),document.addEventListener("touchend",U)):(e(),H()),function(){e()}}),[F]);var Y=l.useThrottledCallback((function(e,t,n){_.current="onResize Event";var a=n.clientWidth,r=n.clientHeight,l=I,d=X;"right"===t?O?d=j(o-a/p.width*(o-i)):l=j(i+a/p.width*(o-i)):"left"===t?O?l=j(i+a/p.width*(o-i)):d=j(o-a/p.width*(o-i)):"bottom"===t?O?d=j(o-r/p.height*(o-i)):l=j(i+r/p.height*(o-i)):"top"===t&&(O?l=j(i+r/p.height*(o-i)):d=j(o-r/p.height*(o-i))),l=Math.min(l,X),d=Math.max(d,I),L([l,d]),x([l,d])})),A=l.useThrottledCallback((function(){_.current=null,H()})),V=function(e,t){_.current={xPos:e,yPos:t,head:I,tail:X}},G=function(e,t){if(_.current){var n;"horizontal"===g?n=(_.current.xPos-e)/p.width*(o-i):"vertical"===g&&(n=(_.current.yPos-t)/p.height*(o-i));var a,r,l=_.current.head-n*(O?-1:1),d=_.current.tail-n*(O?-1:1),u=_.current.tail-_.current.head;l<=i?(a=i,r=i+u):d>=o?(a=o-u,r=o):(a=l,r=d),a=j(a),r=j(r),L([a,r]),x([a,r])}},J=l.useThrottledCallback((function(e){G(e.clientX,e.clientY)})),K=l.useThrottledCallback((function(){_.current=null,N(!1)})),Q=l.useThrottledCallback((function(e){G(e.touches[0].pageX,e.touches[0].pageY)})),U=l.useThrottledCallback((function(){_.current=null,N(!1)})),Z=l.useThrottledCallback((function(e){L([e,X]),x([e,X])})),$=l.useThrottledCallback((function(e){L([I,e]),x([I,e])})),ee=n.useMemo((function(){return(X-I)/(o-i)*("vertical"===g?p.height:p.width)<30}),[i,o,I,X]),te=function(e){var t={min:i,max:X,value:I,onChange:Z},n={min:I,max:o,value:X,onChange:$};return"head"===e?c.jsx(d.Handle,b({"data-testid":"".concat(y,"_handle_top"),placement:"head",readOnly:!z,displayFormatter:w,orientation:g,classes:C,minimal:P},O?n:t)):"tail"===e?c.jsx(d.Handle,b({"data-testid":"".concat(y,"_handle_bottom"),placement:"tail",readOnly:!z,displayFormatter:w,orientation:g,classes:C,minimal:P},O?t:n)):null};return c.jsx("div",{className:E.rootWrapper,children:c.jsxs("div",{className:v.default(E.root,(t={},m.default(t,E.horizontalRoot,"horizontal"===g),m.default(t,E.verticalRoot,"vertical"===g),m.default(t,E.minimal,P),t)),children:[c.jsx(a.Resizable,{ref:q,minHeight:0,minWidth:0,enable:{right:"horizontal"===g,bottom:"vertical"===g},handleComponent:{right:te("head"),bottom:te("head")},onResize:Y,onResizeStop:A}),c.jsx("div",{className:E.body,"data-testid":"slider-body",onMouseDown:function(e){V(e.clientX,e.clientY),N(!0)},onTouchStart:function(e){V(e.touches[0].pageX,e.touches[0].pageY),N(!0)},children:ee?c.jsx("div",{className:v.default((r={},m.default(r,E.horizontalBodyHandle,"horizontal"===g),m.default(r,E.verticalBodyHandle,"vertical"===g),m.default(r,E.leftBodyHandle,"left"===S),m.default(r,E.rightBodyHandle,"right"===S),m.default(r,E.topBodyHandle,"top"===S),m.default(r,E.bottomBodyHandle,"bottom"===S),r)),children:c.jsx("div",{className:E.bodyHandle,"data-testid":"".concat(y,"_handle"),children:c.jsx(u.HandleIcon,{orientation:"vertical",minimal:P})})}):c.jsx("div",{className:E.bodyHandleIcon,"data-testid":"".concat(y,"_handle"),children:c.jsx(u.HandleIcon,{orientation:g,minimal:P})})}),c.jsx(a.Resizable,{ref:R,minHeight:0,minWidth:0,enable:{left:"horizontal"===g,top:"vertical"===g},handleComponent:{left:te("tail"),top:te("tail")},onResize:Y,onResizeStop:A})]})})};g.defaultProps={orientation:"horizontal",valueFormatter:Math.floor,displayFormatter:function(e){return e},onChange:o.noop,onStop:o.noop,reversed:!1,editableHandles:!0,handleClasses:{},minimal:!1};var j=r.withSize({monitorWidth:!0,monitorHeight:!0})(g);exports.AdvancedSlider=g,exports.default=j;
@@ -1 +1 @@
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
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),a=require("@babel/runtime/helpers/slicedToArray"),t=require("react"),l=require("@material-ui/core"),i=require("classnames"),r=require("lodash");require("./styles/sliderStyles.js");var n=require("./styles/handleStyles.js"),d=require("react/jsx-runtime");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=o(e),s=o(a),c=o(i),f=r.debounce((function(e){e()}),500);exports.Handle=function(e){var a,i,r=e.value,o=e.orientation,h=e.placement,m=e.readOnly,v=e.onChange,p=e.min,H=e.max,y=e.displayFormatter,b=e.classes,q=e.minimal,R=e["data-testid"],j=n.useHandleStyles(),z=t.useState(r),x=s.default(z,2),T=x[0],N=x[1],S=t.useRef(null);t.useEffect((function(){N(r)}),[r]);return d.jsx("div",{className:c.default(j.root,b.handleRoot,(a={},u.default(a,j.horizontalHeadRoot,"horizontal"===o&&"head"===h),u.default(a,j.horizontalTailRoot,"horizontal"===o&&"tail"===h),u.default(a,j.verticalHeadRoot,"vertical"===o&&"head"===h),u.default(a,j.verticalTailRoot,"vertical"===o&&"tail"===h),u.default(a,j.minimalHandleRoot,q),a)),children:d.jsx("div",{className:c.default(j.handle,b.handle,(i={},u.default(i,j.horizontalHeadHandle,"horizontal"===o&&"head"===h),u.default(i,j.horizontalTailHandle,"horizontal"===o&&"tail"===h),u.default(i,j.verticalHeadHandle,"vertical"===o&&"head"===h),u.default(i,j.verticalTailHandle,"vertical"===o&&"tail"===h),u.default(i,j.minimalHandle,q),u.default(i,j.minimalVerticalHandle,q&&"vertical"===o),i)),"data-testid":R,children:!q&&d.jsx(l.Input,{inputProps:{"data-testid":"handle-input"},readOnly:m,inputRef:S,classes:{root:j.inputRoot},value:m?y(T):T,onChange:function(e){var a=e.target.value;N(a),Number.isFinite(+a)&&+a>=p&&+a<=H&&f((function(){v(+a)}))},disableUnderline:!0,error:!(Number.isFinite(+T)&&+T>=p&&+T<=H)})})})};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime");exports.HandleIcon=function(e){var i=e.orientation;return e.minimal?"horizontal"===i?t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"20",viewBox:"0 -2 16 16",fill:"none",children:t.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.33333 4L4 4L4 12L5.33333 12L5.33333 4ZM8.66659 4L8.66659 12L7.33325 12L7.33325 4L8.66659 4ZM12.0001 4L12.0001 12L10.6667 12L10.6667 4L12.0001 4Z",fill:"white"})}):t.jsxs("svg",{width:"12",height:"7",viewBox:"0 0 12 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("rect",{width:"12",height:"1"}),t.jsx("rect",{y:"3",width:"12",height:"1"}),t.jsx("rect",{y:"6",width:"12",height:"1"})]}):"horizontal"===i?t.jsxs("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("rect",{x:"7.5",y:"0.5",width:"12",height:"1",transform:"rotate(90 7.5 0.5)"}),t.jsx("rect",{x:"4.5",y:"0.5",width:"12",height:"1",transform:"rotate(90 4.5 0.5)"}),t.jsx("rect",{x:"1.5",y:"0.5",width:"12",height:"1",transform:"rotate(90 1.5 0.5)"})]}):t.jsxs("svg",{width:"12",height:"7",viewBox:"0 0 12 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("rect",{width:"12",height:"1"}),t.jsx("rect",{y:"3",width:"12",height:"1"}),t.jsx("rect",{y:"6",width:"12",height:"1"})]})};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@material-ui/core"),r={minWidth:47,height:20,borderRadius:4},t=e.makeStyles((function(e){var t=e.isLightTheme,o=e.palette;return{root:{position:"absolute","&:hover":{borderColor:o.primary.main},"&:active":{borderColor:o.primary.main},"&:hover $handle":{borderColor:o.primary.main},"&:active $handle":{background:o.primary.dark,borderColor:o.primary.main},"&:hover $inputRoot":{background:o.primary.dark,border:"1px solid ".concat(o.primary.main)},"&:active $inputRoot":{background:o.primary.dark,border:"1px solid ".concat(o.primary.main)},display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},horizontalHeadRoot:{top:0,bottom:0,right:5},horizontalTailRoot:{top:0,bottom:0,left:5},verticalHeadRoot:{left:0,right:0,bottom:5},verticalTailRoot:{left:0,right:0,top:5},handle:{position:"relative",background:t?"#B1B1B1":"#414141","& > p":{fontSize:"12px",textAlign:"center",lineHeight:"20px"},display:"flex",alignItems:"center",justifyContent:"center","&:before":{position:"absolute",left:"50%",top:"50%",height:64,width:64,content:'""',transform:"translate(-50%, -50%)",zIndex:100}},horizontalHeadHandle:r,horizontalTailHandle:r,verticalHeadHandle:r,verticalTailHandle:r,inputRoot:{borderRadius:4,minWidth:47,zIndex:101,height:"20px",fontSize:"12px",border:"1px solid ".concat(o.primary.text9),"&:hover":{border:"1px solid ".concat(o.primary.main)},"&:active":{textDecoration:"underline"},"&::before":{borderWidth:0},"&::after":{borderWidth:"1px !important"},"& .MuiInputBase-input":{padding:0,height:"100%",textAlign:"center"},"&:hover::before":{borderWidth:"1px !important"},"&.Mui-focused":{textDecoration:"underline",background:o.primary.dark,border:"1px solid ".concat(o.primary.main)}},minimalHandle:{background:o.primary.text9,width:8,height:20,"& .MuiInput-underline.Mui-error:after":{border:0}},minimalVerticalHandle:{width:20,height:8},minimalHandleRoot:{borderColor:o.primary.text9,zIndex:100,"&:not(:hover)":{border:"none"}}}}));exports.useHandleStyles=t;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("@material-ui/core"),e=o.makeStyles((function(e){return{rootWrapper:{position:"relative",width:"100%",height:"100%",zIndex:100},root:{position:"absolute",width:"100%",height:"100%",zIndex:100,"&:hover:not($minimal) $body":{background:"#008BA366"},"&:hover $bodyHandle":{visibility:"visible"}},horizontalRoot:{display:"flex",alignItems:"center"},verticalRoot:{display:"flex",alignItems:"center",flexDirection:"column"},body:{position:"relative",flex:1,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none",background:"#3B3B3B66",color:"#BDBDBD","& svg":{fill:"currentColor"},"&:hover":{cursor:"grab",background:"#008BA366",color:"#FFFFFF"},"&:active":{cursor:"grabbing"},"&:hover $bodyHandleIcon":{visibility:"visible"}},horizontalBodyHandle:{position:"absolute",bottom:-24},verticalBodyHandle:{position:"absolute",left:-24},leftBodyHandle:{position:"absolute",left:-24,right:"auto"},rightBodyHandle:{position:"absolute",right:-24,left:"auto"},topBodyHandle:{position:"absolute",top:-24,bottom:"auto"},bottomBodyHandle:{position:"absolute",bottom:-24,top:"auto"},bodyHandle:{width:24,height:24,borderRadius:"50%",background:"#03BCD4",color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",visibility:"hidden"},bodyHandleIcon:{visibility:"hidden"},minimal:{border:"1px solid ".concat(e.palette.background.b9),borderRadius:4,"& $body":{"&:hover":{background:"#008BA366"},margin:-1,width:"calc(100% + 2px)",height:"calc(100% + 2px)",backgroundColor:o.fade(e.palette.background.b7,.1),border:"1px solid ".concat(e.palette.primary.text9),borderRadius:4}}}}));exports.useSliderStyles=e;
@@ -1 +1 @@
1
- {"version":3,"file":"AdvancedSlider.d.ts","sourceRoot":"","sources":["../../../src/components/AdvancedSlider/AdvancedSlider.js"],"names":[],"mappings":"AA2BO,wDA4VN;;;;;QAKmB,kDAAc"}
1
+ {"version":3,"file":"AdvancedSlider.d.ts","sourceRoot":"","sources":["../../../src/components/AdvancedSlider/AdvancedSlider.js"],"names":[],"mappings":"AA6BO,wDA4VN;;;;;QAKmB,kDAAc"}
@@ -1 +1 @@
1
- import t from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import{useRef as i,useState as o,useEffect as n,useMemo as r}from"react";import{makeStyles as a,fade as l}from"@material-ui/core";import{Resizable as d}from"re-resizable";import{withSize as h}from"react-sizeme";import c from"classnames";import{noop as s}from"lodash";import{useThrottledCallback as u}from"../shared/useThrottledCallback.js";import{Handle as m}from"./Handle.js";import{jsx as p,jsxs as v}from"react/jsx-runtime";function g(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,o)}return i}function f(e){for(var i=1;i<arguments.length;i++){var o=null!=arguments[i]?arguments[i]:{};i%2?g(Object(o),!0).forEach((function(i){t(e,i,o[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):g(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var b="twoValuesSliderDefault",y=function(a){var l,h,s=a.min,g=a.max,y=a.value,w=a.size,B=a.orientation,H=a.valueFormatter,L=a.displayFormatter,O=a.editableHandles,F=a.onChange,j=a.onStop,P=a.reversed,C=a.handlePosition,R=a.handleClasses,S=a.minimal,D=z(),E=i(null),M=i(null),k=o([H(null==y?void 0:y.at(0)),H(null==y?void 0:y.at(1))]),I=e(k,2),N=I[0],W=I[1],_=i(null),$=o(!1),A=e($,2),X=A[0],Y=A[1];n((function(){if(!_.current){var t=[H(null==y?void 0:y.at(0)),H(null==y?void 0:y.at(1))],e=Math.min.apply(Math,t),i=Math.max.apply(Math,t);W([e,i])}}),[null==y?void 0:y.at(0),null==y?void 0:y.at(1)]);var T=e(N,2),Z=T[0],V=T[1];n((function(){if("horizontal"===B){var t=w.width/(g-s)*(Z-s),e=w.width/(g-s)*(g-V);E.current.updateSize({width:P?e:t,height:w.height}),M.current.updateSize({width:P?t:e,height:w.height})}else if("vertical"===B){var i=w.height/(g-s)*(Z-s),o=w.height/(g-s)*(g-V);E.current.updateSize({width:w.width,height:P?o:i}),M.current.updateSize({width:w.width,height:P?i:o})}}),[s,g,Z,V,w.width,w.height,B]),n((function(){var t=function(){document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",U),document.removeEventListener("touchmove",tt),document.removeEventListener("touchend",et)};return X?(document.addEventListener("mousemove",Q),document.addEventListener("mouseup",U),document.addEventListener("touchmove",tt),document.addEventListener("touchend",et)):(t(),j()),function(){t()}}),[X]);var q=u((function(t,e,i){_.current="onResize Event";var o=i.clientWidth,n=i.clientHeight,r=Z,a=V;"right"===e?P?a=H(g-o/w.width*(g-s)):r=H(s+o/w.width*(g-s)):"left"===e?P?r=H(s+o/w.width*(g-s)):a=H(g-o/w.width*(g-s)):"bottom"===e?P?a=H(g-n/w.height*(g-s)):r=H(s+n/w.height*(g-s)):"top"===e&&(P?r=H(s+n/w.height*(g-s)):a=H(g-n/w.height*(g-s))),r=Math.min(r,V),a=Math.max(a,Z),W([r,a]),F([r,a])})),G=u((function(){_.current=null,j()})),J=function(t,e){_.current={xPos:t,yPos:e,head:Z,tail:V}},K=function(t,e){if(_.current){var i;"horizontal"===B?i=(_.current.xPos-t)/w.width*(g-s):"vertical"===B&&(i=(_.current.yPos-e)/w.height*(g-s));var o,n,r=_.current.head-i*(P?-1:1),a=_.current.tail-i*(P?-1:1),l=_.current.tail-_.current.head;r<=s?(o=s,n=s+l):a>=g?(o=g-l,n=g):(o=r,n=a),o=H(o),n=H(n),W([o,n]),F([o,n])}},Q=u((function(t){K(t.clientX,t.clientY)})),U=u((function(){_.current=null,Y(!1)})),tt=u((function(t){K(t.touches[0].pageX,t.touches[0].pageY)})),et=u((function(){_.current=null,Y(!1)})),it=u((function(t){W([t,V]),F([t,V])})),ot=u((function(t){W([Z,t]),F([Z,t])})),nt=r((function(){return(V-Z)/(g-s)*("vertical"===B?w.height:w.width)<30}),[s,g,Z,V]),rt=function(t){var e={min:s,max:V,value:Z,onChange:it},i={min:Z,max:g,value:V,onChange:ot};return"head"===t?p(m,f({"data-testid":"".concat(b,"_handle_top"),placement:"head",readOnly:!O,displayFormatter:L,orientation:B,classes:R,minimal:S},P?i:e)):"tail"===t?p(m,f({"data-testid":"".concat(b,"_handle_bottom"),placement:"tail",readOnly:!O,displayFormatter:L,orientation:B,classes:R,minimal:S},P?e:i)):null};return p("div",{className:D.rootWrapper,children:v("div",{className:c(D.root,(l={},t(l,D.horizontalRoot,"horizontal"===B),t(l,D.verticalRoot,"vertical"===B),t(l,D.minimal,S),l)),children:[p(d,{ref:E,minHeight:0,minWidth:0,enable:{right:"horizontal"===B,bottom:"vertical"===B},handleComponent:{right:rt("head"),bottom:rt("head")},onResize:q,onResizeStop:G}),p("div",{className:D.body,"data-testid":"slider-body",onMouseDown:function(t){J(t.clientX,t.clientY),Y(!0)},onTouchStart:function(t){J(t.touches[0].pageX,t.touches[0].pageY),Y(!0)},children:p("div",nt?{className:c((h={},t(h,D.horizontalBodyHandle,"horizontal"===B),t(h,D.verticalBodyHandle,"vertical"===B),t(h,D.leftBodyHandle,"left"===C),t(h,D.rightBodyHandle,"right"===C),t(h,D.topBodyHandle,"top"===C),t(h,D.bottomBodyHandle,"bottom"===C),h)),children:p("div",{className:D.bodyHandle,"data-testid":"".concat(b,"_handle"),children:p(x,{orientation:"vertical",minimal:S})})}:{className:D.bodyHandleIcon,"data-testid":"".concat(b,"_handle"),children:p(x,{orientation:B,minimal:S})})}),p(d,{ref:M,minHeight:0,minWidth:0,enable:{left:"horizontal"===B,top:"vertical"===B},handleComponent:{left:rt("tail"),top:rt("tail")},onResize:q,onResizeStop:G})]})})};y.defaultProps={orientation:"horizontal",valueFormatter:Math.floor,displayFormatter:function(t){return t},onChange:s,onStop:s,reversed:!1,editableHandles:!0,handleClasses:{},minimal:!1};var w=h({monitorWidth:!0,monitorHeight:!0})(y),x=function(t){var e=t.orientation;return t.minimal?"horizontal"===e?p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"20",viewBox:"0 -2 16 16",fill:"none",children:p("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.33333 4L4 4L4 12L5.33333 12L5.33333 4ZM8.66659 4L8.66659 12L7.33325 12L7.33325 4L8.66659 4ZM12.0001 4L12.0001 12L10.6667 12L10.6667 4L12.0001 4Z",fill:"white"})}):v("svg",{width:"12",height:"7",viewBox:"0 0 12 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p("rect",{width:"12",height:"1"}),p("rect",{y:"3",width:"12",height:"1"}),p("rect",{y:"6",width:"12",height:"1"})]}):v("svg","horizontal"===e?{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p("rect",{x:"7.5",y:"0.5",width:"12",height:"1",transform:"rotate(90 7.5 0.5)"}),p("rect",{x:"4.5",y:"0.5",width:"12",height:"1",transform:"rotate(90 4.5 0.5)"}),p("rect",{x:"1.5",y:"0.5",width:"12",height:"1",transform:"rotate(90 1.5 0.5)"})]}:{width:"12",height:"7",viewBox:"0 0 12 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[p("rect",{width:"12",height:"1"}),p("rect",{y:"3",width:"12",height:"1"}),p("rect",{y:"6",width:"12",height:"1"})]})},z=a((function(t){return{rootWrapper:{position:"relative",width:"100%",height:"100%",zIndex:100},root:{position:"absolute",width:"100%",height:"100%",zIndex:100,"&:hover:not($minimal) $body":{background:"#008BA366"},"&:hover $bodyHandle":{visibility:"visible"}},horizontalRoot:{display:"flex",alignItems:"center"},verticalRoot:{display:"flex",alignItems:"center",flexDirection:"column"},body:{position:"relative",flex:1,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none",background:"#3B3B3B66",color:"#BDBDBD","& svg":{fill:"currentColor"},"&:hover":{cursor:"grab",background:"#008BA366",color:"#FFFFFF"},"&:active":{cursor:"grabbing"},"&:hover $bodyHandleIcon":{visibility:"visible"}},horizontalBodyHandle:{position:"absolute",bottom:-24},verticalBodyHandle:{position:"absolute",left:-24},leftBodyHandle:{position:"absolute",left:-24,right:"auto"},rightBodyHandle:{position:"absolute",right:-24,left:"auto"},topBodyHandle:{position:"absolute",top:-24,bottom:"auto"},bottomBodyHandle:{position:"absolute",bottom:-24,top:"auto"},bodyHandle:{width:24,height:24,borderRadius:"50%",background:"#03BCD4",color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",visibility:"hidden"},bodyHandleIcon:{visibility:"hidden"},minimal:{border:"1px solid ".concat(t.palette.background.b9),borderRadius:4,"& $body":{"&:hover":{background:"#008BA366"},margin:-1,width:"calc(100% + 2px)",height:"calc(100% + 2px)",backgroundColor:l(t.palette.background.b7,.1),border:"1px solid ".concat(t.palette.primary.text9),borderRadius:4}}}}));export{y as AdvancedSlider,w as default};
1
+ import t from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import{useRef as n,useState as o,useEffect as i,useMemo as r}from"react";import{Resizable as a}from"re-resizable";import{withSize as l}from"react-sizeme";import d from"classnames";import{noop as c}from"lodash";import{useThrottledCallback as h}from"../shared/useThrottledCallback.js";import{Handle as u}from"./Handle.js";import{HandleIcon as s}from"./icons/HandleIcon.js";import{useSliderStyles as m}from"./styles/sliderStyles.js";import"./styles/handleStyles.js";import{jsx as p,jsxs as v}from"react/jsx-runtime";function f(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function g(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?f(Object(o),!0).forEach((function(n){t(e,n,o[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):f(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}var y="twoValuesSliderDefault",b=function(l){var c,f,b=l.min,w=l.max,z=l.value,O=l.size,j=l.orientation,H=l.valueFormatter,P=l.displayFormatter,S=l.editableHandles,E=l.onChange,x=l.onStop,C=l.reversed,L=l.handlePosition,M=l.handleClasses,R=l.minimal,B=m(),D=n(null),F=n(null),N=o([H(null==z?void 0:z.at(0)),H(null==z?void 0:z.at(1))]),_=e(N,2),W=_[0],X=_[1],Y=n(null),T=o(!1),k=e(T,2),I=k[0],A=k[1];i((function(){if(!Y.current){var t=[H(null==z?void 0:z.at(0)),H(null==z?void 0:z.at(1))],e=Math.min.apply(Math,t),n=Math.max.apply(Math,t);X([e,n])}}),[null==z?void 0:z.at(0),null==z?void 0:z.at(1)]);var V=e(W,2),q=V[0],G=V[1];i((function(){if("horizontal"===j){var t=O.width/(w-b)*(q-b),e=O.width/(w-b)*(w-G);D.current.updateSize({width:C?e:t,height:O.height}),F.current.updateSize({width:C?t:e,height:O.height})}else if("vertical"===j){var n=O.height/(w-b)*(q-b),o=O.height/(w-b)*(w-G);D.current.updateSize({width:O.width,height:C?o:n}),F.current.updateSize({width:O.width,height:C?n:o})}}),[b,w,q,G,O.width,O.height,j]),i((function(){var t=function(){document.removeEventListener("mousemove",Z),document.removeEventListener("mouseup",$),document.removeEventListener("touchmove",tt),document.removeEventListener("touchend",et)};return I?(document.addEventListener("mousemove",Z),document.addEventListener("mouseup",$),document.addEventListener("touchmove",tt),document.addEventListener("touchend",et)):(t(),x()),function(){t()}}),[I]);var J=h((function(t,e,n){Y.current="onResize Event";var o=n.clientWidth,i=n.clientHeight,r=q,a=G;"right"===e?C?a=H(w-o/O.width*(w-b)):r=H(b+o/O.width*(w-b)):"left"===e?C?r=H(b+o/O.width*(w-b)):a=H(w-o/O.width*(w-b)):"bottom"===e?C?a=H(w-i/O.height*(w-b)):r=H(b+i/O.height*(w-b)):"top"===e&&(C?r=H(b+i/O.height*(w-b)):a=H(w-i/O.height*(w-b))),r=Math.min(r,G),a=Math.max(a,q),X([r,a]),E([r,a])})),K=h((function(){Y.current=null,x()})),Q=function(t,e){Y.current={xPos:t,yPos:e,head:q,tail:G}},U=function(t,e){if(Y.current){var n;"horizontal"===j?n=(Y.current.xPos-t)/O.width*(w-b):"vertical"===j&&(n=(Y.current.yPos-e)/O.height*(w-b));var o,i,r=Y.current.head-n*(C?-1:1),a=Y.current.tail-n*(C?-1:1),l=Y.current.tail-Y.current.head;r<=b?(o=b,i=b+l):a>=w?(o=w-l,i=w):(o=r,i=a),o=H(o),i=H(i),X([o,i]),E([o,i])}},Z=h((function(t){U(t.clientX,t.clientY)})),$=h((function(){Y.current=null,A(!1)})),tt=h((function(t){U(t.touches[0].pageX,t.touches[0].pageY)})),et=h((function(){Y.current=null,A(!1)})),nt=h((function(t){X([t,G]),E([t,G])})),ot=h((function(t){X([q,t]),E([q,t])})),it=r((function(){return(G-q)/(w-b)*("vertical"===j?O.height:O.width)<30}),[b,w,q,G]),rt=function(t){var e={min:b,max:G,value:q,onChange:nt},n={min:q,max:w,value:G,onChange:ot};return"head"===t?p(u,g({"data-testid":"".concat(y,"_handle_top"),placement:"head",readOnly:!S,displayFormatter:P,orientation:j,classes:M,minimal:R},C?n:e)):"tail"===t?p(u,g({"data-testid":"".concat(y,"_handle_bottom"),placement:"tail",readOnly:!S,displayFormatter:P,orientation:j,classes:M,minimal:R},C?e:n)):null};return p("div",{className:B.rootWrapper,children:v("div",{className:d(B.root,(c={},t(c,B.horizontalRoot,"horizontal"===j),t(c,B.verticalRoot,"vertical"===j),t(c,B.minimal,R),c)),children:[p(a,{ref:D,minHeight:0,minWidth:0,enable:{right:"horizontal"===j,bottom:"vertical"===j},handleComponent:{right:rt("head"),bottom:rt("head")},onResize:J,onResizeStop:K}),p("div",{className:B.body,"data-testid":"slider-body",onMouseDown:function(t){Q(t.clientX,t.clientY),A(!0)},onTouchStart:function(t){Q(t.touches[0].pageX,t.touches[0].pageY),A(!0)},children:p("div",it?{className:d((f={},t(f,B.horizontalBodyHandle,"horizontal"===j),t(f,B.verticalBodyHandle,"vertical"===j),t(f,B.leftBodyHandle,"left"===L),t(f,B.rightBodyHandle,"right"===L),t(f,B.topBodyHandle,"top"===L),t(f,B.bottomBodyHandle,"bottom"===L),f)),children:p("div",{className:B.bodyHandle,"data-testid":"".concat(y,"_handle"),children:p(s,{orientation:"vertical",minimal:R})})}:{className:B.bodyHandleIcon,"data-testid":"".concat(y,"_handle"),children:p(s,{orientation:j,minimal:R})})}),p(a,{ref:F,minHeight:0,minWidth:0,enable:{left:"horizontal"===j,top:"vertical"===j},handleComponent:{left:rt("tail"),top:rt("tail")},onResize:J,onResizeStop:K})]})})};b.defaultProps={orientation:"horizontal",valueFormatter:Math.floor,displayFormatter:function(t){return t},onChange:c,onStop:c,reversed:!1,editableHandles:!0,handleClasses:{},minimal:!1};var w=l({monitorWidth:!0,monitorHeight:!0})(b);export{b as AdvancedSlider,w as default};
@@ -1 +1 @@
1
- {"version":3,"file":"Handle.d.ts","sourceRoot":"","sources":["../../../src/components/AdvancedSlider/Handle.js"],"names":[],"mappings":"AAqBO;;;;;;;;;;;;gBAqEN"}
1
+ {"version":3,"file":"Handle.d.ts","sourceRoot":"","sources":["../../../src/components/AdvancedSlider/Handle.js"],"names":[],"mappings":"AAsBO;;;;;;;;;;;;gBAsEN"}
@@ -1 +1 @@
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};
1
+ import a from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/slicedToArray";import{useState as t,useRef as i,useEffect as l}from"react";import{Input as r}from"@material-ui/core";import o from"classnames";import{debounce as n}from"lodash";import"./styles/sliderStyles.js";import{useHandleStyles as d}from"./styles/handleStyles.js";import{jsx as m}from"react/jsx-runtime";var s=n((function(a){a()}),500),c=function(n){var c,h,p=n.value,u=n.orientation,v=n.placement,f=n.readOnly,H=n.onChange,y=n.min,z=n.max,R=n.displayFormatter,b=n.classes,T=n.minimal,N=n["data-testid"],g=d(),j=t(p),x=e(j,2),F=x[0],C=x[1],O=i(null);l((function(){C(p)}),[p]);return m("div",{className:o(g.root,b.handleRoot,(c={},a(c,g.horizontalHeadRoot,"horizontal"===u&&"head"===v),a(c,g.horizontalTailRoot,"horizontal"===u&&"tail"===v),a(c,g.verticalHeadRoot,"vertical"===u&&"head"===v),a(c,g.verticalTailRoot,"vertical"===u&&"tail"===v),a(c,g.minimalHandleRoot,T),c)),children:m("div",{className:o(g.handle,b.handle,(h={},a(h,g.horizontalHeadHandle,"horizontal"===u&&"head"===v),a(h,g.horizontalTailHandle,"horizontal"===u&&"tail"===v),a(h,g.verticalHeadHandle,"vertical"===u&&"head"===v),a(h,g.verticalTailHandle,"vertical"===u&&"tail"===v),a(h,g.minimalHandle,T),a(h,g.minimalVerticalHandle,T&&"vertical"===u),h)),"data-testid":N,children:!T&&m(r,{inputProps:{"data-testid":"handle-input"},readOnly:f,inputRef:O,classes:{root:g.inputRoot},value:f?R(F):F,onChange:function(a){var e=a.target.value;C(e),Number.isFinite(+e)&&+e>=y&&+e<=z&&s((function(){H(+e)}))},disableUnderline:!0,error:!(Number.isFinite(+F)&&+F>=y&&+F<=z)})})})};export{c as Handle};
@@ -0,0 +1,5 @@
1
+ export function HandleIcon({ orientation, minimal }: {
2
+ orientation: any;
3
+ minimal: any;
4
+ }): JSX.Element;
5
+ //# sourceMappingURL=HandleIcon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HandleIcon.d.ts","sourceRoot":"","sources":["../../../../src/components/AdvancedSlider/icons/HandleIcon.js"],"names":[],"mappings":"AAAO;;;gBAsCN"}
@@ -0,0 +1 @@
1
+ import{jsx as t,jsxs as h}from"react/jsx-runtime";var i=function(i){var e=i.orientation;return i.minimal?"horizontal"===e?t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"20",viewBox:"0 -2 16 16",fill:"none",children:t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.33333 4L4 4L4 12L5.33333 12L5.33333 4ZM8.66659 4L8.66659 12L7.33325 12L7.33325 4L8.66659 4ZM12.0001 4L12.0001 12L10.6667 12L10.6667 4L12.0001 4Z",fill:"white"})}):h("svg",{width:"12",height:"7",viewBox:"0 0 12 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("rect",{width:"12",height:"1"}),t("rect",{y:"3",width:"12",height:"1"}),t("rect",{y:"6",width:"12",height:"1"})]}):h("svg","horizontal"===e?{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("rect",{x:"7.5",y:"0.5",width:"12",height:"1",transform:"rotate(90 7.5 0.5)"}),t("rect",{x:"4.5",y:"0.5",width:"12",height:"1",transform:"rotate(90 4.5 0.5)"}),t("rect",{x:"1.5",y:"0.5",width:"12",height:"1",transform:"rotate(90 1.5 0.5)"})]}:{width:"12",height:"7",viewBox:"0 0 12 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("rect",{width:"12",height:"1"}),t("rect",{y:"3",width:"12",height:"1"}),t("rect",{y:"6",width:"12",height:"1"})]})};export{i as HandleIcon};
@@ -0,0 +1,2 @@
1
+ export * from "./HandleIcon";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/AdvancedSlider/icons/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export const useHandleStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"handle" | "root" | "inputRoot" | "horizontalHeadRoot" | "horizontalTailRoot" | "verticalHeadRoot" | "verticalTailRoot" | "horizontalHeadHandle" | "horizontalTailHandle" | "verticalHeadHandle" | "verticalTailHandle" | "minimalHandle" | "minimalVerticalHandle" | "minimalHandleRoot">;
2
+ //# sourceMappingURL=handleStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handleStyles.d.ts","sourceRoot":"","sources":["../../../../src/components/AdvancedSlider/styles/handleStyles.js"],"names":[],"mappings":"AAWA,qXA2HI"}
@@ -0,0 +1 @@
1
+ import{makeStyles as r}from"@material-ui/core";var e={minWidth:47,height:20,borderRadius:4},t=r((function(r){var t=r.isLightTheme,o=r.palette;return{root:{position:"absolute","&:hover":{borderColor:o.primary.main},"&:active":{borderColor:o.primary.main},"&:hover $handle":{borderColor:o.primary.main},"&:active $handle":{background:o.primary.dark,borderColor:o.primary.main},"&:hover $inputRoot":{background:o.primary.dark,border:"1px solid ".concat(o.primary.main)},"&:active $inputRoot":{background:o.primary.dark,border:"1px solid ".concat(o.primary.main)},display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},horizontalHeadRoot:{top:0,bottom:0,right:5},horizontalTailRoot:{top:0,bottom:0,left:5},verticalHeadRoot:{left:0,right:0,bottom:5},verticalTailRoot:{left:0,right:0,top:5},handle:{position:"relative",background:t?"#B1B1B1":"#414141","& > p":{fontSize:"12px",textAlign:"center",lineHeight:"20px"},display:"flex",alignItems:"center",justifyContent:"center","&:before":{position:"absolute",left:"50%",top:"50%",height:64,width:64,content:'""',transform:"translate(-50%, -50%)",zIndex:100}},horizontalHeadHandle:e,horizontalTailHandle:e,verticalHeadHandle:e,verticalTailHandle:e,inputRoot:{borderRadius:4,minWidth:47,zIndex:101,height:"20px",fontSize:"12px",border:"1px solid ".concat(o.primary.text9),"&:hover":{border:"1px solid ".concat(o.primary.main)},"&:active":{textDecoration:"underline"},"&::before":{borderWidth:0},"&::after":{borderWidth:"1px !important"},"& .MuiInputBase-input":{padding:0,height:"100%",textAlign:"center"},"&:hover::before":{borderWidth:"1px !important"},"&.Mui-focused":{textDecoration:"underline",background:o.primary.dark,border:"1px solid ".concat(o.primary.main)}},minimalHandle:{background:o.primary.text9,width:8,height:20,"& .MuiInput-underline.Mui-error:after":{border:0}},minimalVerticalHandle:{width:20,height:8},minimalHandleRoot:{borderColor:o.primary.text9,zIndex:100,"&:not(:hover)":{border:"none"}}}}));export{t as useHandleStyles};
@@ -0,0 +1,3 @@
1
+ export * from "./sliderStyles";
2
+ export * from "./handleStyles";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/AdvancedSlider/styles/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export const useSliderStyles: (props?: any) => import("@material-ui/styles").ClassNameMap<"body" | "root" | "rootWrapper" | "horizontalRoot" | "verticalRoot" | "horizontalBodyHandle" | "verticalBodyHandle" | "leftBodyHandle" | "rightBodyHandle" | "topBodyHandle" | "bottomBodyHandle" | "bodyHandle" | "bodyHandleIcon" | "minimal">;
2
+ //# sourceMappingURL=sliderStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sliderStyles.d.ts","sourceRoot":"","sources":["../../../../src/components/AdvancedSlider/styles/sliderStyles.js"],"names":[],"mappings":"AAIA,2UA+GI"}
@@ -0,0 +1 @@
1
+ import{makeStyles as o,fade as t}from"@material-ui/core";var e=o((function(o){return{rootWrapper:{position:"relative",width:"100%",height:"100%",zIndex:100},root:{position:"absolute",width:"100%",height:"100%",zIndex:100,"&:hover:not($minimal) $body":{background:"#008BA366"},"&:hover $bodyHandle":{visibility:"visible"}},horizontalRoot:{display:"flex",alignItems:"center"},verticalRoot:{display:"flex",alignItems:"center",flexDirection:"column"},body:{position:"relative",flex:1,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none",background:"#3B3B3B66",color:"#BDBDBD","& svg":{fill:"currentColor"},"&:hover":{cursor:"grab",background:"#008BA366",color:"#FFFFFF"},"&:active":{cursor:"grabbing"},"&:hover $bodyHandleIcon":{visibility:"visible"}},horizontalBodyHandle:{position:"absolute",bottom:-24},verticalBodyHandle:{position:"absolute",left:-24},leftBodyHandle:{position:"absolute",left:-24,right:"auto"},rightBodyHandle:{position:"absolute",right:-24,left:"auto"},topBodyHandle:{position:"absolute",top:-24,bottom:"auto"},bottomBodyHandle:{position:"absolute",bottom:-24,top:"auto"},bodyHandle:{width:24,height:24,borderRadius:"50%",background:"#03BCD4",color:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"center",visibility:"hidden"},bodyHandleIcon:{visibility:"hidden"},minimal:{border:"1px solid ".concat(o.palette.background.b9),borderRadius:4,"& $body":{"&:hover":{background:"#008BA366"},margin:-1,width:"calc(100% + 2px)",height:"calc(100% + 2px)",backgroundColor:t(o.palette.background.b7,.1),border:"1px solid ".concat(o.palette.primary.text9),borderRadius:4}}}}));export{e as useSliderStyles};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "0.81.0-12",
3
+ "version": "0.81.0-13",
4
4
  "description": "Shared components/utils for Corva ui projects",
5
5
  "keywords": [
6
6
  "corva-ui"