react-circular-range 1.0.95 → 1.0.97
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.
- package/dist/index.js +1 -1
- package/package.json +5 -1
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
import{useCallback as e,useEffect as t,useRef as n,useState as r}from"react";var o={698(e,t){var n=Symbol.for("react.transitional.element");function r(e,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var
|
|
2
|
+
import{useCallback as e,useEffect as t,useRef as n,useState as r}from"react";var o={698(e,t){var n=Symbol.for("react.transitional.element");function r(e,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var a in r={},t)"key"!==a&&(r[a]=t[a]);else r=t;return t=r.ref,{$$typeof:n,type:e,key:o,ref:void 0!==t?t:null,props:r}}Symbol.for("react.fragment"),t.jsx=r,t.jsxs=r},848(e,t,n){e.exports=n(698)}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return o[e](n,n.exports,s),n.exports}s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var c={};s.r(c),s.d(c,{active:()=>i,knob:()=>d,knobBackground:()=>l,knobBackgroundPath:()=>m,knobCenter:()=>v,knobIndicator:()=>k,knobRing:()=>b});var u=s(848),i="CircularRange-module__active--BqXnY",d="CircularRange-module__knob--BAUKG",l="CircularRange-module__knobBackground--qxu1s",m="CircularRange-module__knobBackgroundPath--rxKDz",v="CircularRange-module__knobCenter--UIeoG",k="CircularRange-module__knobIndicator--lJKRO",b="CircularRange-module__knobRing--F6qGP";const f=113.1,g=({min:o=0,max:a=100,value:s=0,step:i=.01,onChange:d,theme:l=c})=>{const m=n(null),[v,k]=r(s),[b,g]=r(!1),h=n(0),p=n(0);t(()=>{k(s)},[s]);const y=e(e=>(e-o)/(a-o),[o,a]),x=e(e=>{let t=(e=>Math.min(a,Math.max(o,e)))(e);i>0&&(t=Math.round(t/i)*i),k(t),d?.(t)},[o,a,i,d]),_=e=>{e.preventDefault(),g(!0);const t="touches"in e?e.touches[0].clientY:e.clientY;h.current=t,p.current=v},E=e=>{if(!b)return;e.preventDefault();const t="touches"in e?e.touches[0].clientY:e.clientY,n=.01*(h.current-t)*(a-o);x(p.current+n)},L=()=>{g(!1)},j=()=>{x((o+a)/2)};t(()=>{const e=m.current;if(e)return e.addEventListener("mousedown",_),e.addEventListener("touchstart",_),document.addEventListener("mousemove",E),document.addEventListener("touchmove",E),document.addEventListener("mouseup",L),document.addEventListener("touchend",L),e.addEventListener("dblclick",j),()=>{e.removeEventListener("mousedown",_),e.removeEventListener("touchstart",_),document.removeEventListener("mousemove",E),document.removeEventListener("touchmove",E),document.removeEventListener("mouseup",L),document.removeEventListener("touchend",L),e.removeEventListener("dblclick",j)}},[E,b]);const C=y(v),R=270*C-135,$=f-C*f;return(0,u.jsx)("div",{ref:m,className:`${l.knob} ${b?l.active:""}`,children:(0,u.jsxs)("div",{className:`${l.knobRing}`,children:[(0,u.jsx)("svg",{className:`${l.knobBackground}`,viewBox:"0 0 60 60",children:(0,u.jsx)("path",{className:`${l.knobBackgroundPath}`,d:"M 30 6 A 24 24 0 1 1 6 30",strokeDasharray:f,strokeDashoffset:$})}),(0,u.jsx)("div",{className:`${l.knobIndicator}`,style:{transform:`translateX(-50%) rotate(${R}deg)`}}),(0,u.jsx)("div",{className:`${l.knobCenter}`})]})})};export{g as CircularRange};
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-circular-range",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.97",
|
|
4
4
|
"description": "Simple VST-like circular slider/range.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
|
+
"sideEffects": [
|
|
9
|
+
"*.css",
|
|
10
|
+
"*.module.css"
|
|
11
|
+
],
|
|
8
12
|
"files": [
|
|
9
13
|
"dist"
|
|
10
14
|
],
|