Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@radix-ui/react-slider

Package Overview
Dependencies
Maintainers
5
Versions
178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-slider - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

2

dist/index.js

@@ -1,2 +0,2 @@

function e(e){return e&&e.__esModule?e.default:e}function n(e,n,r){Object.defineProperty(e,n,{get:r,enumerable:!0})}var r=require("@radix-ui/react-collection").createCollection,t=require("@radix-ui/react-primitive").Primitive,o=require("@radix-ui/react-use-size").useSize,i=require("@radix-ui/react-use-controllable-state").useControllableState,u=require("@radix-ui/react-use-callback-ref").useCallbackRef,a=require("@radix-ui/react-context").createContext,l=require("@radix-ui/react-compose-refs").useComposedRefs,c=require("@radix-ui/primitive").composeEventHandlers,s=require("@radix-ui/number").clamp,d=require("react"),f=d.createElement,v=d.Fragment,m=d.forwardRef,b=d.useRef,p=d.createContext,h=d.useMemo,S=d.useEffect,g=d.useContext,j=d.useState,y=e(require("@babel/runtime-corejs3/core-js-stable/instance/slice")),w=e(require("@babel/runtime-corejs3/core-js-stable/instance/sort")),x=e(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor")),M=e(require("@babel/runtime-corejs3/core-js-stable/instance/values")),q=e(require("@babel/runtime-corejs3/core-js-stable/instance/concat")),T=e(require("@babel/runtime-corejs3/core-js-stable/instance/map")),D=e(require("@babel/runtime-corejs3/core-js-stable/instance/includes")),E=e(require("@babel/runtime-corejs3/core-js-stable/instance/index-of")),P=e(require("@babel/runtime-corejs3/core-js-stable/promise")),C=e(require("@babel/runtime-corejs3/core-js-stable/set-timeout")),K=e(require("@babel/runtime-corejs3/core-js-stable/set")),R=e(require("@babel/runtime-corejs3/helpers/slicedToArray")),k=e(require("@babel/runtime-corejs3/helpers/objectWithoutProperties")),A=e(require("@babel/runtime-corejs3/helpers/toConsumableArray")),L=e(require("@babel/runtime-corejs3/helpers/extends")),U=e(require("@babel/runtime-corejs3/helpers/defineProperty"));require("core-js/modules/es.string.split.js"),require("core-js/modules/es.regexp.to-string.js"),require("core-js/modules/es.object.to-string.js");var z=e(require("@babel/runtime-corejs3/core-js-stable/object/define-property")),H=e(require("@babel/runtime-corejs3/core-js-stable/object/define-properties")),I=e(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors")),F=e(require("@babel/runtime-corejs3/core-js-stable/instance/for-each")),V=e(require("@babel/runtime-corejs3/core-js-stable/instance/filter")),X=e(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols")),Y=e(require("@babel/runtime-corejs3/core-js-stable/object/keys")),B={};function N(e,n){var r=Y(e);if(X){var t=X(e);n&&(t=V(t).call(t,(function(n){return x(e,n).enumerable}))),r.push.apply(r,t)}return r}function O(e){for(var n=1;n<arguments.length;n++){var r,t=null!=arguments[n]?arguments[n]:{};if(n%2)F(r=N(Object(t),!0)).call(r,(function(n){U(e,n,t[n])}));else if(I)H(e,I(t));else{var o;F(o=N(Object(t))).call(o,(function(n){z(e,n,x(t,n))}))}}return e}var _=["PageUp","PageDown"],W=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],G={ltr:["ArrowDown","Home","ArrowLeft","PageUp"],rtl:["ArrowDown","Home","ArrowRight","PageDown"]},J=r("Slider"),Q=R(J,2),Z=Q[0],$=Q[1],ee=Z((function(e){return f(v,null,e.children)})),ne=a("Slider"),re=R(ne,2),te=re[0],oe=re[1],ie=m((function(e,n){var r=e.name,t=e.min,o=void 0===t?0:t,u=e.max,a=void 0===u?100:u,c=e.step,d=void 0===c?1:c,v=e.orientation,m=void 0===v?"horizontal":v,p=e.disabled,h=void 0!==p&&p,S=e.minStepsBetweenThumbs,g=void 0===S?0:S,j=e.defaultValue,y=void 0===j?[o]:j,w=e.value,x=e.onValueChange,M=void 0===x?function(){}:x,q=k(e,["name","min","max","step","orientation","disabled","minStepsBetweenThumbs","defaultValue","value","onValueChange"]),U=b(null),z=l(n,U),H=b(new K),I=b(0),F="horizontal"===m?ae:le,V=i({prop:w,defaultProp:y,onChange:M}),X=R(V,2),Y=X[0],B=void 0===Y?[]:Y,N=X[1];function O(e,n){var r=function(e){return(String(e).split(".")[1]||"").length}(d),t=function(e,n){var r=Math.pow(10,n);return Math.round(e*r)/r}(Math.round((e-o)/d)*d+o,r),i=s(t,[o,a]);return new P((function(e){N((function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=be(r,i,n);return Se(t,g*d)?(I.current=E(t).call(t,i),e(I.current),t[n]!==r[n]?t:r):(e(I.current),r)}))}))}function G(e){var n;null===(n=A(H.current)[e])||void 0===n||n.focus()}return f(te,{disabled:h,min:o,max:a,valueIndexToChangeRef:I,thumbs:H.current,values:B,orientation:m},f(ee,null,f(F,L({"aria-disabled":h,"data-disabled":h?"":void 0},q,{ref:z,min:o,max:a,onSlideStart:h?void 0:function(e){O(e,function(e,n){if(1===e.length)return 0;var r=T(e).call(e,(function(e){return Math.abs(e-n)})),t=Math.min.apply(Math,A(r));return E(r).call(r,t)}(B,e)).then((function(e){C((function(){return G(e)}),0)}))},onSlideMove:h?void 0:function(e){O(e,I.current).then(G)},onHomeKeyDown:function(){return!h&&O(o,0)},onEndKeyDown:function(){return!h&&O(a,B.length-1)},onStepKeyDown:function(e){var n=e.event,r=e.direction;if(!h){var t=D(_).call(_,n.key)||n.shiftKey&&D(W).call(W,n.key)?10:1,o=I.current;O(B[o]+d*t*r,o)}}})),r&&T(B).call(B,(function(e,n){return f(me,{key:n,name:r+(B.length>1?"[]":""),value:e,hidden:!0})}))))}));exports.Slider=ie,ie.displayName="Slider";var ue=p({}),ae=m((function(e,n){var r=e.min,t=e.max,o=e.dir,i=e.onSlideStart,u=e.onSlideMove,a=e.onStepKeyDown,c=k(e,["min","max","dir","onSlideStart","onSlideMove","onStepKeyDown"]),s=b(null),d=l(n,s),v=b(),m=function(e){var n=e.ref,r=e.directionProp,t=j("ltr"),o=R(t,2),i=o[0],u=o[1],a=j(),l=R(a,2),c=l[0],s=l[1],d=b(0);return S((function(){if(void 0===r){var e=getComputedStyle(n.current);s(e)}}),[r,n]),S((function(){function e(){d.current=requestAnimationFrame((function(){var n=null==c?void 0:c.direction;n&&u(n),e()}))}return void 0===r&&e(),function(){return cancelAnimationFrame(d.current)}}),[c,r,u]),r||i}({ref:s,directionProp:o}),p="ltr"===m;function g(e){var n=v.current||s.current.getBoundingClientRect(),o=ge([0,n.width],p?[r,t]:[t,r]);return v.current=n,o(e-n.left)}return f(ue.Provider,{value:h((function(){return{startEdge:p?"left":"right",endEdge:p?"right":"left",direction:p?1:-1,size:"width"}}),[p])},f(ce,L({"data-orientation":"horizontal"},c,{ref:d,style:O(O({},c.style),{},{"--radix-slider-thumb-transform":"translateX(-50%)"}),onSlideMouseDown:function(e){var n=g(e.clientX);null==i||i(n)},onSlideMouseMove:function(e){var n=g(e.clientX);null==u||u(n)},onSlideMouseUp:function(){return v.current=void 0},onSlideTouchStart:function(e){var n=g(e.targetTouches[0].clientX);null==i||i(n)},onSlideTouchMove:function(e){var n=g(e.targetTouches[0].clientX);null==u||u(n)},onSlideTouchEnd:function(){return v.current=void 0},onStepKeyDown:function(e){function n(n){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((function(e){var n,r=D(n=G[m]).call(n,e.key);null==a||a({event:e,direction:r?-1:1})}))})))})),le=m((function(e,n){var r=e.min,t=e.max,o=e.onSlideStart,i=e.onSlideMove,u=e.onStepKeyDown,a=k(e,["min","max","onSlideStart","onSlideMove","onStepKeyDown"]),c=b(null),s=l(n,c),d=b();function v(e){var n=d.current||c.current.getBoundingClientRect(),o=ge([0,n.height],[t,r]);return d.current=n,o(e-n.top)}return f(ue.Provider,{value:h((function(){return{startEdge:"bottom",endEdge:"top",size:"height",direction:1}}),[])},f(ce,L({"data-orientation":"vertical"},a,{ref:s,style:O(O({},a.style),{},{"--radix-slider-thumb-transform":"translateY(50%)"}),onSlideMouseDown:function(e){var n=v(e.clientY);null==o||o(n)},onSlideMouseMove:function(e){var n=v(e.clientY);null==i||i(n)},onSlideMouseUp:function(){return d.current=void 0},onSlideTouchStart:function(e){var n=v(e.targetTouches[0].clientY);null==o||o(n)},onSlideTouchMove:function(e){var n=v(e.targetTouches[0].clientY);null==i||i(n)},onSlideTouchEnd:function(){return d.current=void 0},onStepKeyDown:function(e){function n(n){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((function(e){var n,r=D(n=G.ltr).call(n,e.key);null==u||u({event:e,direction:r?-1:1})}))})))})),ce=m((function(e,n){var r=e.as,o=void 0===r?"span":r,i=e.onSlideMouseDown,a=e.onSlideMouseMove,l=e.onSlideMouseUp,s=e.onSlideTouchStart,d=e.onSlideTouchMove,v=e.onSlideTouchEnd,m=e.onHomeKeyDown,b=e.onEndKeyDown,p=e.onStepKeyDown,h=k(e,["as","onSlideMouseDown","onSlideMouseMove","onSlideMouseUp","onSlideTouchStart","onSlideTouchMove","onSlideTouchEnd","onHomeKeyDown","onEndKeyDown","onStepKeyDown"]),g=u(a),j=u(d),y=u((function(){document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",y),l()})),w=u((function(){document.removeEventListener("touchmove",j),document.removeEventListener("touchend",w),v()}));return S((function(){return function(){y(),w()}}),[y,w]),f(t,L({},h,{as:o,ref:n,onMouseDown:c(e.onMouseDown,(function(e){0===e.button&&(pe(e.target)||i(e),document.addEventListener("mousemove",g),document.addEventListener("mouseup",y))})),onTouchStart:c(e.onTouchStart,(function(e){pe(e.target)?e.target.focus():s(e),document.addEventListener("touchmove",j),document.addEventListener("touchend",w),e.preventDefault()})),onKeyDown:c(e.onKeyDown,(function(e){var n;"Home"===e.key?m(e):"End"===e.key?b(e):D(n=q(_).call(_,W)).call(n,e.key)&&(p(e),e.preventDefault())})),onPointerDown:c(e.onPointerDown,(function(e){e.target.setPointerCapture(e.pointerId)})),onPointerUp:c(e.onPointerUp,(function(e){e.target.releasePointerCapture(e.pointerId)}))}))})),se=m((function(e,n){var r=e.as,o=void 0===r?"span":r,i=k(e,["as"]),u=oe("SliderTrack");return f(t,L({"data-disabled":u.disabled?"":void 0,"data-orientation":u.orientation},i,{as:o,ref:n}))}));exports.SliderTrack=se,se.displayName="SliderTrack";var de=m((function(e,n){var r,o=e.as,i=void 0===o?"span":o,u=k(e,["as"]),a=oe("SliderRange"),c=g(ue),s=b(null),d=l(n,s),v=M(a).length,m=T(r=M(a)).call(r,(function(e){return he(e,a.min,a.max)})),p=v>1?Math.min.apply(Math,A(m)):0,h=100-Math.max.apply(Math,A(m));return f(t,L({"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0},u,{as:i,ref:d,style:O(O({},e.style),{},{[c.startEdge]:p+"%",[c.endEdge]:h+"%"})}))}));exports.SliderRange=de,de.displayName="SliderRange";var fe=m((function(e,n){var r=$(),t=r.ref,o=r.index,i=l(n,t),u=oe("SliderThumb"),a=M(u)[o];return void 0!==a?f(ve,L({},e,{ref:i,index:o,value:a})):null}));exports.SliderThumb=fe;var ve=m((function(e,n){var r,i,u,a,s,d,v=e.as,m=void 0===v?"span":v,p=e.index,h=e.value,j=k(e,["as","index","value"]),y=oe("SliderThumb"),w=g(ue),x=b(null),T=l(n,x),D=o(x),E=he(h,y.min,y.max),P=function(e,n){var r;return n>2?q(r="Value ".concat(e+1," of ")).call(r,n):2===n?["Minimum","Maximum"][e]:void 0}(p,M(y).length),C=null==D?void 0:D[w.size],K=C?(i=C,u=E,a=w.direction,d=ge([0,50],[0,s=i/2]),(s-d(u)*a)*a):0;return S((function(){var e=x.current;if(e)return y.thumbs.add(e),function(){y.thumbs.delete(e)}}),[y.thumbs]),f("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[w.startEdge]:q(r="calc(".concat(E,"% + ")).call(r,K,"px)")}},f(t,L({"data-radix-slider-thumb":"",role:"slider","aria-label":e["aria-label"]||P,"aria-valuemin":y.min,"aria-valuenow":h,"aria-valuemax":y.max,"aria-orientation":y.orientation,"data-orientation":y.orientation,"data-disabled":y.disabled?"":void 0,tabIndex:0},j,{as:m,ref:T,onFocus:c(e.onFocus,(function(){y.valueIndexToChangeRef.current=p}))})))}));fe.displayName="SliderThumb";var me=function(e){var n=e.value,r=k(e,["value"]),t=b(null);return S((function(){var e=t.current,r=window.HTMLInputElement.prototype,o=x(r,"value").set;if(o){var i=new Event("input",{bubbles:!0});o.call(e,n),e.dispatchEvent(i)}}),[n]),f("input",L({hidden:!0},r,{ref:t}))};function be(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,t=A(e);return t[r]=n,w(t).call(t,(function(e,n){return e-n}))}function pe(e){return""===e.getAttribute("data-radix-slider-thumb")}function he(e,n,r){return 100/(r-n)*(e-n)}function Se(e,n){if(n>0){var r=function(e){var n;return T(n=y(e).call(e,0,-1)).call(n,(function(n,r){return e[r+1]-n}))}(e);return Math.min.apply(Math,A(r))>=n}return!0}function ge(e,n){return function(r){if(e[0]===e[1]||n[0]===n[1])return n[0];var t=(n[1]-n[0])/(e[1]-e[0]);return n[0]+t*(r-e[0])}}var je=ie;exports.Root=je;var ye=se;exports.Track=ye;var we=de;exports.Range=we;var xe=fe;exports.Thumb=xe,n(B,"Thumb",(function(){return xe})),n(B,"Range",(function(){return we})),n(B,"Track",(function(){return ye})),n(B,"Root",(function(){return je})),n(B,"SliderThumb",(function(){return fe})),n(B,"SliderRange",(function(){return de})),n(B,"SliderTrack",(function(){return se})),n(B,"Slider",(function(){return ie}));
function e(e,n,t){Object.defineProperty(e,n,{get:t,enumerable:!0})}var n,t=require("@radix-ui/react-collection").createCollection,r=require("@radix-ui/react-primitive").Primitive,o=require("@radix-ui/react-use-size").useSize,i=require("@radix-ui/react-use-controllable-state").useControllableState,u=require("@radix-ui/react-use-callback-ref").useCallbackRef,a=require("@radix-ui/react-context").createContext,l=require("@radix-ui/react-compose-refs").useComposedRefs,d=require("@radix-ui/primitive").composeEventHandlers,c=require("@radix-ui/number").clamp,s=require("react"),m=s.createElement,f=s.Fragment,v=s.forwardRef,h=s.useRef,p=s.createContext,S=s.useMemo,g=s.useEffect,b=s.useContext,x=s.useState,w=(n=require("@babel/runtime/helpers/extends"))&&n.__esModule?n.default:n,y={};const M=["PageUp","PageDown"],T=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],D={ltr:["ArrowDown","Home","ArrowLeft","PageUp"],rtl:["ArrowDown","Home","ArrowRight","PageDown"]},[E,P]=t("Slider"),R=E((e=>m(f,null,e.children))),k="span",[C,K]=a("Slider"),q=v(((e,n)=>{const{name:t,min:r=0,max:o=100,step:u=1,orientation:a="horizontal",disabled:d=!1,minStepsBetweenThumbs:s=0,defaultValue:f=[r],value:v,onValueChange:p=(()=>{}),...S}=e,g=h(null),b=l(n,g),x=h(new Set),y=h(0),D="horizontal"===a?L:z,[E=[],P]=i({prop:v,defaultProp:f,onChange:p});function k(e,n){const t=function(e){return(String(e).split(".")[1]||"").length}(u),i=function(e,n){const t=Math.pow(10,n);return Math.round(e*t)/t}(Math.round((e-r)/u)*u+r,t),a=c(i,[r,o]);return new Promise((e=>{P(((t=[])=>{const r=function(e=[],n,t){const r=[...e];return r[t]=n,r.sort(((e,n)=>e-n))}(t,a,n);return function(e,n){if(n>0){const t=function(e){return e.slice(0,-1).map(((n,t)=>e[t+1]-n))}(e);return Math.min(...t)>=n}return!0}(r,s*u)?(y.current=r.indexOf(a),e(y.current),r[n]!==t[n]?r:t):(e(y.current),t)}))}))}function K(e){var n;null===(n=[...x.current][e])||void 0===n||n.focus()}return m(C,{disabled:d,min:r,max:o,valueIndexToChangeRef:y,thumbs:x.current,values:E,orientation:a},m(R,null,m(D,w({"aria-disabled":d,"data-disabled":d?"":void 0},S,{ref:b,min:r,max:o,onSlideStart:d?void 0:function(e){k(e,function(e,n){if(1===e.length)return 0;const t=e.map((e=>Math.abs(e-n))),r=Math.min(...t);return t.indexOf(r)}(E,e)).then((e=>{window.setTimeout((()=>K(e)),0)}))},onSlideMove:d?void 0:function(e){k(e,y.current).then(K)},onHomeKeyDown:()=>!d&&k(r,0),onEndKeyDown:()=>!d&&k(o,E.length-1),onStepKeyDown:({event:e,direction:n})=>{if(!d){const t=M.includes(e.key)||e.shiftKey&&T.includes(e.key)?10:1,r=y.current;k(E[r]+u*t*n,r)}}})),t&&E.map(((e,n)=>m($,{key:n,name:t+(E.length>1?"[]":""),value:e,hidden:!0})))))}));exports.Slider=q,q.displayName="Slider";const A=p({}),L=v(((e,n)=>{const{min:t,max:r,dir:o,onSlideStart:i,onSlideMove:u,onStepKeyDown:a,...d}=e,c=h(null),s=l(n,c),f=h(),v=function({ref:e,directionProp:n}){const[t,r]=x("ltr"),[o,i]=x(),u=h(0);return g((()=>{if(void 0===n){const n=getComputedStyle(e.current);i(n)}}),[n,e]),g((()=>{function e(){u.current=requestAnimationFrame((()=>{const n=null==o?void 0:o.direction;n&&r(n),e()}))}return void 0===n&&e(),()=>cancelAnimationFrame(u.current)}),[o,n,r]),n||t}({ref:c,directionProp:o}),p="ltr"===v;function b(e){const n=f.current||c.current.getBoundingClientRect(),o=j([0,n.width],p?[t,r]:[r,t]);return f.current=n,o(e-n.left)}return m(A.Provider,{value:S((()=>({startEdge:p?"left":"right",endEdge:p?"right":"left",direction:p?1:-1,size:"width"})),[p])},m(U,w({"data-orientation":"horizontal"},d,{ref:s,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideMouseDown:e=>{const n=b(e.clientX);null==i||i(n)},onSlideMouseMove:e=>{const n=b(e.clientX);null==u||u(n)},onSlideMouseUp:()=>f.current=void 0,onSlideTouchStart:e=>{const n=b(e.targetTouches[0].clientX);null==i||i(n)},onSlideTouchMove:e=>{const n=b(e.targetTouches[0].clientX);null==u||u(n)},onSlideTouchEnd:()=>f.current=void 0,onStepKeyDown:e=>{const n=D[v].includes(e.key);null==a||a({event:e,direction:n?-1:1})}})))})),z=v(((e,n)=>{const{min:t,max:r,onSlideStart:o,onSlideMove:i,onStepKeyDown:u,...a}=e,d=h(null),c=l(n,d),s=h();function f(e){const n=s.current||d.current.getBoundingClientRect(),o=j([0,n.height],[r,t]);return s.current=n,o(e-n.top)}return m(A.Provider,{value:S((()=>({startEdge:"bottom",endEdge:"top",size:"height",direction:1})),[])},m(U,w({"data-orientation":"vertical"},a,{ref:c,style:{...a.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideMouseDown:e=>{const n=f(e.clientY);null==o||o(n)},onSlideMouseMove:e=>{const n=f(e.clientY);null==i||i(n)},onSlideMouseUp:()=>s.current=void 0,onSlideTouchStart:e=>{const n=f(e.targetTouches[0].clientY);null==o||o(n)},onSlideTouchMove:e=>{const n=f(e.targetTouches[0].clientY);null==i||i(n)},onSlideTouchEnd:()=>s.current=void 0,onStepKeyDown:e=>{const n=D.ltr.includes(e.key);null==u||u({event:e,direction:n?-1:1})}})))})),U=v(((e,n)=>{const{as:t=k,onSlideMouseDown:o,onSlideMouseMove:i,onSlideMouseUp:a,onSlideTouchStart:l,onSlideTouchMove:c,onSlideTouchEnd:s,onHomeKeyDown:f,onEndKeyDown:v,onStepKeyDown:h,...p}=e,S=u(i),b=u(c),x=u((()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",x),a()})),y=u((()=>{document.removeEventListener("touchmove",b),document.removeEventListener("touchend",y),s()}));return g((()=>()=>{x(),y()}),[x,y]),m(r,w({},p,{as:t,ref:n,onMouseDown:d(e.onMouseDown,(e=>{0===e.button&&(B(e.target)||o(e),document.addEventListener("mousemove",S),document.addEventListener("mouseup",x))})),onTouchStart:d(e.onTouchStart,(e=>{B(e.target)?e.target.focus():l(e),document.addEventListener("touchmove",b),document.addEventListener("touchend",y),e.preventDefault()})),onKeyDown:d(e.onKeyDown,(e=>{"Home"===e.key?f(e):"End"===e.key?v(e):M.concat(T).includes(e.key)&&(h(e),e.preventDefault())})),onPointerDown:d(e.onPointerDown,(e=>{e.target.setPointerCapture(e.pointerId)})),onPointerUp:d(e.onPointerUp,(e=>{e.target.releasePointerCapture(e.pointerId)}))}))})),H="span",I=v(((e,n)=>{const{as:t=H,...o}=e,i=K("SliderTrack");return m(r,w({"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation},o,{as:t,ref:n}))}));exports.SliderTrack=I,I.displayName="SliderTrack";const F="span",O=v(((e,n)=>{const{as:t=F,...o}=e,i=K("SliderRange"),u=b(A),a=h(null),d=l(n,a),c=i.values.length,s=i.values.map((e=>V(e,i.min,i.max))),f=c>1?Math.min(...s):0,v=100-Math.max(...s);return m(r,w({"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0},o,{as:t,ref:d,style:{...e.style,[u.startEdge]:f+"%",[u.endEdge]:v+"%"}}))}));exports.SliderRange=O,O.displayName="SliderRange";const X="span",Y=v(((e,n)=>{const{ref:t,index:r}=P(),o=l(n,t),i=K("SliderThumb").values[r];return void 0!==i?m(N,w({},e,{ref:o,index:r,value:i})):null}));exports.SliderThumb=Y;const N=v(((e,n)=>{const{as:t=X,index:i,value:u,...a}=e,c=K("SliderThumb"),s=b(A),f=h(null),v=l(n,f),p=o(f),S=V(u,c.min,c.max),x=function(e,n){return n>2?`Value ${e+1} of ${n}`:2===n?["Minimum","Maximum"][e]:void 0}(i,c.values.length),y=null==p?void 0:p[s.size],M=y?function(e,n,t){const r=e/2,o=j([0,50],[0,r]);return(r-o(n)*t)*t}(y,S,s.direction):0;return g((()=>{const e=f.current;if(e)return c.thumbs.add(e),()=>{c.thumbs.delete(e)}}),[c.thumbs]),m("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${S}% + ${M}px)`}},m(r,w({"data-radix-slider-thumb":"",role:"slider","aria-label":e["aria-label"]||x,"aria-valuemin":c.min,"aria-valuenow":u,"aria-valuemax":c.max,"aria-orientation":c.orientation,"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0,tabIndex:0},a,{as:t,ref:v,onFocus:d(e.onFocus,(()=>{c.valueIndexToChangeRef.current=i}))})))}));Y.displayName="SliderThumb";const $=e=>{const{value:n,...t}=e,r=h(null);return g((()=>{const e=r.current,t=window.HTMLInputElement.prototype,{set:o}=Object.getOwnPropertyDescriptor(t,"value");if(o){const t=new Event("input",{bubbles:!0});o.call(e,n),e.dispatchEvent(t)}}),[n]),m("input",w({hidden:!0},t,{ref:r}))};function B(e){return""===e.getAttribute("data-radix-slider-thumb")}function V(e,n,t){return 100/(t-n)*(e-n)}function j(e,n){return t=>{if(e[0]===e[1]||n[0]===n[1])return n[0];const r=(n[1]-n[0])/(e[1]-e[0]);return n[0]+r*(t-e[0])}}const _=q;exports.Root=_;const G=I;exports.Track=G;const J=O;exports.Range=J;const Q=Y;exports.Thumb=Q,e(y,"Thumb",(function(){return Q})),e(y,"Range",(function(){return J})),e(y,"Track",(function(){return G})),e(y,"Root",(function(){return _})),e(y,"SliderThumb",(function(){return Y})),e(y,"SliderRange",(function(){return O})),e(y,"SliderTrack",(function(){return I})),e(y,"Slider",(function(){return q}));
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

function e(e,n,r){Object.defineProperty(e,n,{get:r,enumerable:!0})}import{createCollection as n}from"@radix-ui/react-collection";import{Primitive as r}from"@radix-ui/react-primitive";import{useSize as t}from"@radix-ui/react-use-size";import{useControllableState as o}from"@radix-ui/react-use-controllable-state";import{useCallbackRef as i}from"@radix-ui/react-use-callback-ref";import{createContext as a}from"@radix-ui/react-context";import{useComposedRefs as u}from"@radix-ui/react-compose-refs";import{composeEventHandlers as l}from"@radix-ui/primitive";import{clamp as c}from"@radix-ui/number";import{createElement as d,Fragment as s,forwardRef as m,useRef as f,createContext as v,useMemo as p,useEffect as b,useContext as h,useState as S}from"react";import g from"@babel/runtime-corejs3/core-js-stable/instance/slice";import j from"@babel/runtime-corejs3/core-js-stable/instance/sort";import y from"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";import w from"@babel/runtime-corejs3/core-js-stable/instance/values";import x from"@babel/runtime-corejs3/core-js-stable/instance/concat";import T from"@babel/runtime-corejs3/core-js-stable/instance/map";import M from"@babel/runtime-corejs3/core-js-stable/instance/includes";import D from"@babel/runtime-corejs3/core-js-stable/instance/index-of";import E from"@babel/runtime-corejs3/core-js-stable/promise";import k from"@babel/runtime-corejs3/core-js-stable/set-timeout";import K from"@babel/runtime-corejs3/core-js-stable/set";import P from"@babel/runtime-corejs3/helpers/esm/slicedToArray";import R from"@babel/runtime-corejs3/helpers/esm/objectWithoutProperties";import A from"@babel/runtime-corejs3/helpers/esm/toConsumableArray";import C from"@babel/runtime-corejs3/helpers/esm/extends";import L from"@babel/runtime-corejs3/helpers/esm/defineProperty";import"core-js/modules/es.string.split.js";import"core-js/modules/es.regexp.to-string.js";import"core-js/modules/es.object.to-string.js";import U from"@babel/runtime-corejs3/core-js-stable/object/define-property";import z from"@babel/runtime-corejs3/core-js-stable/object/define-properties";import H from"@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";import I from"@babel/runtime-corejs3/core-js-stable/instance/for-each";import V from"@babel/runtime-corejs3/core-js-stable/instance/filter";import X from"@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";import Y from"@babel/runtime-corejs3/core-js-stable/object/keys";var B={};function F(e,n){var r=Y(e);if(X){var t=X(e);n&&(t=V(t).call(t,(function(n){return y(e,n).enumerable}))),r.push.apply(r,t)}return r}function N(e){for(var n=1;n<arguments.length;n++){var r,t=null!=arguments[n]?arguments[n]:{};if(n%2)I(r=F(Object(t),!0)).call(r,(function(n){L(e,n,t[n])}));else if(H)z(e,H(t));else{var o;I(o=F(Object(t))).call(o,(function(n){U(e,n,y(t,n))}))}}return e}var O=["PageUp","PageDown"],q=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],W={ltr:["ArrowDown","Home","ArrowLeft","PageUp"],rtl:["ArrowDown","Home","ArrowRight","PageDown"]},G=n("Slider"),J=P(G,2),Q=J[0],Z=J[1],$=Q((function(e){return d(s,null,e.children)})),_=a("Slider"),ee=P(_,2),ne=ee[0],re=ee[1];export var Slider=m((function(e,n){var r=e.name,t=e.min,i=void 0===t?0:t,a=e.max,l=void 0===a?100:a,s=e.step,m=void 0===s?1:s,v=e.orientation,p=void 0===v?"horizontal":v,b=e.disabled,h=void 0!==b&&b,S=e.minStepsBetweenThumbs,g=void 0===S?0:S,j=e.defaultValue,y=void 0===j?[i]:j,w=e.value,x=e.onValueChange,L=void 0===x?function(){}:x,U=R(e,["name","min","max","step","orientation","disabled","minStepsBetweenThumbs","defaultValue","value","onValueChange"]),z=f(null),H=u(n,z),I=f(new K),V=f(0),X="horizontal"===p?oe:ie,Y=o({prop:w,defaultProp:y,onChange:L}),B=P(Y,2),F=B[0],N=void 0===F?[]:F,W=B[1];function G(e,n){var r=function(e){return(String(e).split(".")[1]||"").length}(m),t=function(e,n){var r=Math.pow(10,n);return Math.round(e*r)/r}(Math.round((e-i)/m)*m+i,r),o=c(t,[i,l]);return new E((function(e){W((function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=ce(r,o,n);return me(t,g*m)?(V.current=D(t).call(t,o),e(V.current),t[n]!==r[n]?t:r):(e(V.current),r)}))}))}function J(e){var n;null===(n=A(I.current)[e])||void 0===n||n.focus()}return d(ne,{disabled:h,min:i,max:l,valueIndexToChangeRef:V,thumbs:I.current,values:N,orientation:p},d($,null,d(X,C({"aria-disabled":h,"data-disabled":h?"":void 0},U,{ref:H,min:i,max:l,onSlideStart:h?void 0:function(e){G(e,function(e,n){if(1===e.length)return 0;var r=T(e).call(e,(function(e){return Math.abs(e-n)})),t=Math.min.apply(Math,A(r));return D(r).call(r,t)}(N,e)).then((function(e){k((function(){return J(e)}),0)}))},onSlideMove:h?void 0:function(e){G(e,V.current).then(J)},onHomeKeyDown:function(){return!h&&G(i,0)},onEndKeyDown:function(){return!h&&G(l,N.length-1)},onStepKeyDown:function(e){var n=e.event,r=e.direction;if(!h){var t=M(O).call(O,n.key)||n.shiftKey&&M(q).call(q,n.key)?10:1,o=V.current;G(N[o]+m*t*r,o)}}})),r&&T(N).call(N,(function(e,n){return d(le,{key:n,name:r+(N.length>1?"[]":""),value:e,hidden:!0})}))))}));Slider.displayName="Slider";var te=v({}),oe=m((function(e,n){var r=e.min,t=e.max,o=e.dir,i=e.onSlideStart,a=e.onSlideMove,l=e.onStepKeyDown,c=R(e,["min","max","dir","onSlideStart","onSlideMove","onStepKeyDown"]),s=f(null),m=u(n,s),v=f(),h=function(e){var n=e.ref,r=e.directionProp,t=S("ltr"),o=P(t,2),i=o[0],a=o[1],u=S(),l=P(u,2),c=l[0],d=l[1],s=f(0);return b((function(){if(void 0===r){var e=getComputedStyle(n.current);d(e)}}),[r,n]),b((function(){function e(){s.current=requestAnimationFrame((function(){var n=null==c?void 0:c.direction;n&&a(n),e()}))}return void 0===r&&e(),function(){return cancelAnimationFrame(s.current)}}),[c,r,a]),r||i}({ref:s,directionProp:o}),g="ltr"===h;function j(e){var n=v.current||s.current.getBoundingClientRect(),o=fe([0,n.width],g?[r,t]:[t,r]);return v.current=n,o(e-n.left)}return d(te.Provider,{value:p((function(){return{startEdge:g?"left":"right",endEdge:g?"right":"left",direction:g?1:-1,size:"width"}}),[g])},d(ae,C({"data-orientation":"horizontal"},c,{ref:m,style:N(N({},c.style),{},{"--radix-slider-thumb-transform":"translateX(-50%)"}),onSlideMouseDown:function(e){var n=j(e.clientX);null==i||i(n)},onSlideMouseMove:function(e){var n=j(e.clientX);null==a||a(n)},onSlideMouseUp:function(){return v.current=void 0},onSlideTouchStart:function(e){var n=j(e.targetTouches[0].clientX);null==i||i(n)},onSlideTouchMove:function(e){var n=j(e.targetTouches[0].clientX);null==a||a(n)},onSlideTouchEnd:function(){return v.current=void 0},onStepKeyDown:function(e){function n(n){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((function(e){var n,r=M(n=W[h]).call(n,e.key);null==l||l({event:e,direction:r?-1:1})}))})))})),ie=m((function(e,n){var r=e.min,t=e.max,o=e.onSlideStart,i=e.onSlideMove,a=e.onStepKeyDown,l=R(e,["min","max","onSlideStart","onSlideMove","onStepKeyDown"]),c=f(null),s=u(n,c),m=f();function v(e){var n=m.current||c.current.getBoundingClientRect(),o=fe([0,n.height],[t,r]);return m.current=n,o(e-n.top)}return d(te.Provider,{value:p((function(){return{startEdge:"bottom",endEdge:"top",size:"height",direction:1}}),[])},d(ae,C({"data-orientation":"vertical"},l,{ref:s,style:N(N({},l.style),{},{"--radix-slider-thumb-transform":"translateY(50%)"}),onSlideMouseDown:function(e){var n=v(e.clientY);null==o||o(n)},onSlideMouseMove:function(e){var n=v(e.clientY);null==i||i(n)},onSlideMouseUp:function(){return m.current=void 0},onSlideTouchStart:function(e){var n=v(e.targetTouches[0].clientY);null==o||o(n)},onSlideTouchMove:function(e){var n=v(e.targetTouches[0].clientY);null==i||i(n)},onSlideTouchEnd:function(){return m.current=void 0},onStepKeyDown:function(e){function n(n){return e.apply(this,arguments)}return n.toString=function(){return e.toString()},n}((function(e){var n,r=M(n=W.ltr).call(n,e.key);null==a||a({event:e,direction:r?-1:1})}))})))})),ae=m((function(e,n){var t=e.as,o=void 0===t?"span":t,a=e.onSlideMouseDown,u=e.onSlideMouseMove,c=e.onSlideMouseUp,s=e.onSlideTouchStart,m=e.onSlideTouchMove,f=e.onSlideTouchEnd,v=e.onHomeKeyDown,p=e.onEndKeyDown,h=e.onStepKeyDown,S=R(e,["as","onSlideMouseDown","onSlideMouseMove","onSlideMouseUp","onSlideTouchStart","onSlideTouchMove","onSlideTouchEnd","onHomeKeyDown","onEndKeyDown","onStepKeyDown"]),g=i(u),j=i(m),y=i((function(){document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",y),c()})),w=i((function(){document.removeEventListener("touchmove",j),document.removeEventListener("touchend",w),f()}));return b((function(){return function(){y(),w()}}),[y,w]),d(r,C({},S,{as:o,ref:n,onMouseDown:l(e.onMouseDown,(function(e){0===e.button&&(de(e.target)||a(e),document.addEventListener("mousemove",g),document.addEventListener("mouseup",y))})),onTouchStart:l(e.onTouchStart,(function(e){de(e.target)?e.target.focus():s(e),document.addEventListener("touchmove",j),document.addEventListener("touchend",w),e.preventDefault()})),onKeyDown:l(e.onKeyDown,(function(e){var n;"Home"===e.key?v(e):"End"===e.key?p(e):M(n=x(O).call(O,q)).call(n,e.key)&&(h(e),e.preventDefault())})),onPointerDown:l(e.onPointerDown,(function(e){e.target.setPointerCapture(e.pointerId)})),onPointerUp:l(e.onPointerUp,(function(e){e.target.releasePointerCapture(e.pointerId)}))}))}));export var SliderTrack=m((function(e,n){var t=e.as,o=void 0===t?"span":t,i=R(e,["as"]),a=re("SliderTrack");return d(r,C({"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation},i,{as:o,ref:n}))}));SliderTrack.displayName="SliderTrack";export var SliderRange=m((function(e,n){var t,o=e.as,i=void 0===o?"span":o,a=R(e,["as"]),l=re("SliderRange"),c=h(te),s=f(null),m=u(n,s),v=w(l).length,p=T(t=w(l)).call(t,(function(e){return se(e,l.min,l.max)})),b=v>1?Math.min.apply(Math,A(p)):0,S=100-Math.max.apply(Math,A(p));return d(r,C({"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0},a,{as:i,ref:m,style:N(N({},e.style),{},{[c.startEdge]:b+"%",[c.endEdge]:S+"%"})}))}));SliderRange.displayName="SliderRange";export var SliderThumb=m((function(e,n){var r=Z(),t=r.ref,o=r.index,i=u(n,t),a=re("SliderThumb"),l=w(a)[o];return void 0!==l?d(ue,C({},e,{ref:i,index:o,value:l})):null}));var ue=m((function(e,n){var o,i,a,c,s,m,v=e.as,p=void 0===v?"span":v,S=e.index,g=e.value,j=R(e,["as","index","value"]),y=re("SliderThumb"),T=h(te),M=f(null),D=u(n,M),E=t(M),k=se(g,y.min,y.max),K=function(e,n){var r;return n>2?x(r="Value ".concat(e+1," of ")).call(r,n):2===n?["Minimum","Maximum"][e]:void 0}(S,w(y).length),P=null==E?void 0:E[T.size],A=P?(i=P,a=k,c=T.direction,m=fe([0,50],[0,s=i/2]),(s-m(a)*c)*c):0;return b((function(){var e=M.current;if(e)return y.thumbs.add(e),function(){y.thumbs.delete(e)}}),[y.thumbs]),d("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[T.startEdge]:x(o="calc(".concat(k,"% + ")).call(o,A,"px)")}},d(r,C({"data-radix-slider-thumb":"",role:"slider","aria-label":e["aria-label"]||K,"aria-valuemin":y.min,"aria-valuenow":g,"aria-valuemax":y.max,"aria-orientation":y.orientation,"data-orientation":y.orientation,"data-disabled":y.disabled?"":void 0,tabIndex:0},j,{as:p,ref:D,onFocus:l(e.onFocus,(function(){y.valueIndexToChangeRef.current=S}))})))}));SliderThumb.displayName="SliderThumb";var le=function(e){var n=e.value,r=R(e,["value"]),t=f(null);return b((function(){var e=t.current,r=window.HTMLInputElement.prototype,o=y(r,"value").set;if(o){var i=new Event("input",{bubbles:!0});o.call(e,n),e.dispatchEvent(i)}}),[n]),d("input",C({hidden:!0},r,{ref:t}))};function ce(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,t=A(e);return t[r]=n,j(t).call(t,(function(e,n){return e-n}))}function de(e){return""===e.getAttribute("data-radix-slider-thumb")}function se(e,n,r){return 100/(r-n)*(e-n)}function me(e,n){if(n>0){var r=function(e){var n;return T(n=g(e).call(e,0,-1)).call(n,(function(n,r){return e[r+1]-n}))}(e);return Math.min.apply(Math,A(r))>=n}return!0}function fe(e,n){return function(r){if(e[0]===e[1]||n[0]===n[1])return n[0];var t=(n[1]-n[0])/(e[1]-e[0]);return n[0]+t*(r-e[0])}}export var Root=Slider;export var Track=SliderTrack;var ve=SliderRange;export{ve as Range};export var Thumb=SliderThumb;e(B,"Thumb",(function(){return Thumb})),e(B,"Range",(function(){return ve})),e(B,"Track",(function(){return Track})),e(B,"Root",(function(){return Root})),e(B,"SliderThumb",(function(){return SliderThumb})),e(B,"SliderRange",(function(){return SliderRange})),e(B,"SliderTrack",(function(){return SliderTrack})),e(B,"Slider",(function(){return Slider}));
function e(e,n,t){Object.defineProperty(e,n,{get:t,enumerable:!0})}import{createCollection as n}from"@radix-ui/react-collection";import{Primitive as t}from"@radix-ui/react-primitive";import{useSize as r}from"@radix-ui/react-use-size";import{useControllableState as o}from"@radix-ui/react-use-controllable-state";import{useCallbackRef as i}from"@radix-ui/react-use-callback-ref";import{createContext as a}from"@radix-ui/react-context";import{useComposedRefs as u}from"@radix-ui/react-compose-refs";import{composeEventHandlers as l}from"@radix-ui/primitive";import{clamp as d}from"@radix-ui/number";import{createElement as c,Fragment as s,forwardRef as m,useRef as f,createContext as p,useMemo as h,useEffect as v,useContext as S,useState as g}from"react";import b from"@babel/runtime/helpers/esm/extends";var w={};const x=["PageUp","PageDown"],T=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],y={ltr:["ArrowDown","Home","ArrowLeft","PageUp"],rtl:["ArrowDown","Home","ArrowRight","PageDown"]},[M,D]=n("Slider"),E=M((e=>c(s,null,e.children))),k="span",[P,R]=a("Slider");export const Slider=m(((e,n)=>{const{name:t,min:r=0,max:i=100,step:a=1,orientation:l="horizontal",disabled:s=!1,minStepsBetweenThumbs:m=0,defaultValue:p=[r],value:h,onValueChange:v=(()=>{}),...S}=e,g=f(null),w=u(n,g),y=f(new Set),M=f(0),D="horizontal"===l?A:L,[k=[],R]=o({prop:h,defaultProp:p,onChange:v});function K(e,n){const t=function(e){return(String(e).split(".")[1]||"").length}(a),o=function(e,n){const t=Math.pow(10,n);return Math.round(e*t)/t}(Math.round((e-r)/a)*a+r,t),u=d(o,[r,i]);return new Promise((e=>{R(((t=[])=>{const r=function(e=[],n,t){const r=[...e];return r[t]=n,r.sort(((e,n)=>e-n))}(t,u,n);return function(e,n){if(n>0){const t=function(e){return e.slice(0,-1).map(((n,t)=>e[t+1]-n))}(e);return Math.min(...t)>=n}return!0}(r,m*a)?(M.current=r.indexOf(u),e(M.current),r[n]!==t[n]?r:t):(e(M.current),t)}))}))}function C(e){var n;null===(n=[...y.current][e])||void 0===n||n.focus()}return c(P,{disabled:s,min:r,max:i,valueIndexToChangeRef:M,thumbs:y.current,values:k,orientation:l},c(E,null,c(D,b({"aria-disabled":s,"data-disabled":s?"":void 0},S,{ref:w,min:r,max:i,onSlideStart:s?void 0:function(e){K(e,function(e,n){if(1===e.length)return 0;const t=e.map((e=>Math.abs(e-n))),r=Math.min(...t);return t.indexOf(r)}(k,e)).then((e=>{window.setTimeout((()=>C(e)),0)}))},onSlideMove:s?void 0:function(e){K(e,M.current).then(C)},onHomeKeyDown:()=>!s&&K(r,0),onEndKeyDown:()=>!s&&K(i,k.length-1),onStepKeyDown:({event:e,direction:n})=>{if(!s){const t=x.includes(e.key)||e.shiftKey&&T.includes(e.key)?10:1,r=M.current;K(k[r]+a*t*n,r)}}})),t&&k.map(((e,n)=>c(O,{key:n,name:t+(k.length>1?"[]":""),value:e,hidden:!0})))))}));Slider.displayName="Slider";const K=p({}),A=m(((e,n)=>{const{min:t,max:r,dir:o,onSlideStart:i,onSlideMove:a,onStepKeyDown:l,...d}=e,s=f(null),m=u(n,s),p=f(),S=function({ref:e,directionProp:n}){const[t,r]=g("ltr"),[o,i]=g(),a=f(0);return v((()=>{if(void 0===n){const n=getComputedStyle(e.current);i(n)}}),[n,e]),v((()=>{function e(){a.current=requestAnimationFrame((()=>{const n=null==o?void 0:o.direction;n&&r(n),e()}))}return void 0===n&&e(),()=>cancelAnimationFrame(a.current)}),[o,n,r]),n||t}({ref:s,directionProp:o}),w="ltr"===S;function x(e){const n=p.current||s.current.getBoundingClientRect(),o=F([0,n.width],w?[t,r]:[r,t]);return p.current=n,o(e-n.left)}return c(K.Provider,{value:h((()=>({startEdge:w?"left":"right",endEdge:w?"right":"left",direction:w?1:-1,size:"width"})),[w])},c(C,b({"data-orientation":"horizontal"},d,{ref:m,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideMouseDown:e=>{const n=x(e.clientX);null==i||i(n)},onSlideMouseMove:e=>{const n=x(e.clientX);null==a||a(n)},onSlideMouseUp:()=>p.current=void 0,onSlideTouchStart:e=>{const n=x(e.targetTouches[0].clientX);null==i||i(n)},onSlideTouchMove:e=>{const n=x(e.targetTouches[0].clientX);null==a||a(n)},onSlideTouchEnd:()=>p.current=void 0,onStepKeyDown:e=>{const n=y[S].includes(e.key);null==l||l({event:e,direction:n?-1:1})}})))})),L=m(((e,n)=>{const{min:t,max:r,onSlideStart:o,onSlideMove:i,onStepKeyDown:a,...l}=e,d=f(null),s=u(n,d),m=f();function p(e){const n=m.current||d.current.getBoundingClientRect(),o=F([0,n.height],[r,t]);return m.current=n,o(e-n.top)}return c(K.Provider,{value:h((()=>({startEdge:"bottom",endEdge:"top",size:"height",direction:1})),[])},c(C,b({"data-orientation":"vertical"},l,{ref:s,style:{...l.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideMouseDown:e=>{const n=p(e.clientY);null==o||o(n)},onSlideMouseMove:e=>{const n=p(e.clientY);null==i||i(n)},onSlideMouseUp:()=>m.current=void 0,onSlideTouchStart:e=>{const n=p(e.targetTouches[0].clientY);null==o||o(n)},onSlideTouchMove:e=>{const n=p(e.targetTouches[0].clientY);null==i||i(n)},onSlideTouchEnd:()=>m.current=void 0,onStepKeyDown:e=>{const n=y.ltr.includes(e.key);null==a||a({event:e,direction:n?-1:1})}})))})),C=m(((e,n)=>{const{as:r=k,onSlideMouseDown:o,onSlideMouseMove:a,onSlideMouseUp:u,onSlideTouchStart:d,onSlideTouchMove:s,onSlideTouchEnd:m,onHomeKeyDown:f,onEndKeyDown:p,onStepKeyDown:h,...S}=e,g=i(a),w=i(s),y=i((()=>{document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",y),u()})),M=i((()=>{document.removeEventListener("touchmove",w),document.removeEventListener("touchend",M),m()}));return v((()=>()=>{y(),M()}),[y,M]),c(t,b({},S,{as:r,ref:n,onMouseDown:l(e.onMouseDown,(e=>{0===e.button&&(X(e.target)||o(e),document.addEventListener("mousemove",g),document.addEventListener("mouseup",y))})),onTouchStart:l(e.onTouchStart,(e=>{X(e.target)?e.target.focus():d(e),document.addEventListener("touchmove",w),document.addEventListener("touchend",M),e.preventDefault()})),onKeyDown:l(e.onKeyDown,(e=>{"Home"===e.key?f(e):"End"===e.key?p(e):x.concat(T).includes(e.key)&&(h(e),e.preventDefault())})),onPointerDown:l(e.onPointerDown,(e=>{e.target.setPointerCapture(e.pointerId)})),onPointerUp:l(e.onPointerUp,(e=>{e.target.releasePointerCapture(e.pointerId)}))}))})),U="span";export const SliderTrack=m(((e,n)=>{const{as:r=U,...o}=e,i=R("SliderTrack");return c(t,b({"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation},o,{as:r,ref:n}))}));SliderTrack.displayName="SliderTrack";const z="span";export const SliderRange=m(((e,n)=>{const{as:r=z,...o}=e,i=R("SliderRange"),a=S(K),l=f(null),d=u(n,l),s=i.values.length,m=i.values.map((e=>Y(e,i.min,i.max))),p=s>1?Math.min(...m):0,h=100-Math.max(...m);return c(t,b({"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0},o,{as:r,ref:d,style:{...e.style,[a.startEdge]:p+"%",[a.endEdge]:h+"%"}}))}));SliderRange.displayName="SliderRange";const H="span";export const SliderThumb=m(((e,n)=>{const{ref:t,index:r}=D(),o=u(n,t),i=R("SliderThumb").values[r];return void 0!==i?c(I,b({},e,{ref:o,index:r,value:i})):null}));const I=m(((e,n)=>{const{as:o=H,index:i,value:a,...d}=e,s=R("SliderThumb"),m=S(K),p=f(null),h=u(n,p),g=r(p),w=Y(a,s.min,s.max),x=function(e,n){return n>2?`Value ${e+1} of ${n}`:2===n?["Minimum","Maximum"][e]:void 0}(i,s.values.length),T=null==g?void 0:g[m.size],y=T?function(e,n,t){const r=e/2,o=F([0,50],[0,r]);return(r-o(n)*t)*t}(T,w,m.direction):0;return v((()=>{const e=p.current;if(e)return s.thumbs.add(e),()=>{s.thumbs.delete(e)}}),[s.thumbs]),c("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[m.startEdge]:`calc(${w}% + ${y}px)`}},c(t,b({"data-radix-slider-thumb":"",role:"slider","aria-label":e["aria-label"]||x,"aria-valuemin":s.min,"aria-valuenow":a,"aria-valuemax":s.max,"aria-orientation":s.orientation,"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,tabIndex:0},d,{as:o,ref:h,onFocus:l(e.onFocus,(()=>{s.valueIndexToChangeRef.current=i}))})))}));SliderThumb.displayName="SliderThumb";const O=e=>{const{value:n,...t}=e,r=f(null);return v((()=>{const e=r.current,t=window.HTMLInputElement.prototype,{set:o}=Object.getOwnPropertyDescriptor(t,"value");if(o){const t=new Event("input",{bubbles:!0});o.call(e,n),e.dispatchEvent(t)}}),[n]),c("input",b({hidden:!0},t,{ref:r}))};function X(e){return""===e.getAttribute("data-radix-slider-thumb")}function Y(e,n,t){return 100/(t-n)*(e-n)}function F(e,n){return t=>{if(e[0]===e[1]||n[0]===n[1])return n[0];const r=(n[1]-n[0])/(e[1]-e[0]);return n[0]+r*(t-e[0])}}export const Root=Slider;export const Track=SliderTrack;const N=SliderRange;export{N as Range};export const Thumb=SliderThumb;e(w,"Thumb",(function(){return Thumb})),e(w,"Range",(function(){return N})),e(w,"Track",(function(){return Track})),e(w,"Root",(function(){return Root})),e(w,"SliderThumb",(function(){return SliderThumb})),e(w,"SliderRange",(function(){return SliderRange})),e(w,"SliderTrack",(function(){return SliderTrack})),e(w,"Slider",(function(){return Slider}));
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-slider",
"version": "0.0.7",
"version": "0.0.8",
"license": "MIT",

@@ -20,12 +20,12 @@ "source": "src/index.ts",

"dependencies": {
"@babel/runtime-corejs3": "^7.13.10",
"@babel/runtime": "^7.13.10",
"@radix-ui/number": "0.0.2",
"@radix-ui/primitive": "0.0.2",
"@radix-ui/react-collection": "0.0.7",
"@radix-ui/react-collection": "0.0.8",
"@radix-ui/react-compose-refs": "0.0.2",
"@radix-ui/react-context": "0.0.2",
"@radix-ui/react-polymorphic": "0.0.7",
"@radix-ui/react-primitive": "0.0.7",
"@radix-ui/react-primitive": "0.0.8",
"@radix-ui/react-use-callback-ref": "0.0.2",
"@radix-ui/react-use-controllable-state": "0.0.2",
"@radix-ui/react-use-controllable-state": "0.0.3",
"@radix-ui/react-use-size": "0.0.2"

@@ -32,0 +32,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc