@purpurds/slider 6.0.0 → 6.0.2

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/LICENSE.txt CHANGED
@@ -1,41 +1,5 @@
1
- Name: @babel/runtime
2
- Version: 7.26.0
3
- License: MIT
4
- Private: false
5
- Description: babel's modular runtime helpers
6
- Repository: https://github.com/babel/babel.git
7
- Homepage: https://babel.dev/docs/en/next/babel-runtime
8
- Author: The Babel Team (https://babel.dev/team)
9
- License Copyright:
10
- ===
11
-
12
- MIT License
13
-
14
- Copyright (c) 2014-present Sebastian McKenzie and other contributors
15
-
16
- Permission is hereby granted, free of charge, to any person obtaining
17
- a copy of this software and associated documentation files (the
18
- "Software"), to deal in the Software without restriction, including
19
- without limitation the rights to use, copy, modify, merge, publish,
20
- distribute, sublicense, and/or sell copies of the Software, and to
21
- permit persons to whom the Software is furnished to do so, subject to
22
- the following conditions:
23
-
24
- The above copyright notice and this permission notice shall be
25
- included in all copies or substantial portions of the Software.
26
-
27
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
31
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
32
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
33
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34
-
35
- ---
36
-
37
1
  Name: @radix-ui/number
38
- Version: 1.0.1
2
+ Version: 1.1.0
39
3
  License: MIT
40
4
  Private: false
41
5
  Repository: git+https://github.com/radix-ui/primitives.git
@@ -44,7 +8,7 @@ Homepage: https://radix-ui.com/primitives
44
8
  ---
45
9
 
46
10
  Name: @radix-ui/primitive
47
- Version: 1.0.1
11
+ Version: 1.1.1
48
12
  License: MIT
49
13
  Private: false
50
14
  Repository: git+https://github.com/radix-ui/primitives.git
@@ -53,7 +17,7 @@ Homepage: https://radix-ui.com/primitives
53
17
  ---
54
18
 
55
19
  Name: @radix-ui/react-compose-refs
56
- Version: 1.0.1
20
+ Version: 1.1.1
57
21
  License: MIT
58
22
  Private: false
59
23
  Repository: git+https://github.com/radix-ui/primitives.git
@@ -62,7 +26,7 @@ Homepage: https://radix-ui.com/primitives
62
26
  ---
63
27
 
64
28
  Name: @radix-ui/react-context
65
- Version: 1.0.1
29
+ Version: 1.1.1
66
30
  License: MIT
67
31
  Private: false
68
32
  Repository: git+https://github.com/radix-ui/primitives.git
@@ -71,7 +35,7 @@ Homepage: https://radix-ui.com/primitives
71
35
  ---
72
36
 
73
37
  Name: @radix-ui/react-use-callback-ref
74
- Version: 1.0.1
38
+ Version: 1.1.0
75
39
  License: MIT
76
40
  Private: false
77
41
  Repository: git+https://github.com/radix-ui/primitives.git
@@ -80,7 +44,7 @@ Homepage: https://radix-ui.com/primitives
80
44
  ---
81
45
 
82
46
  Name: @radix-ui/react-use-controllable-state
83
- Version: 1.0.1
47
+ Version: 1.1.0
84
48
  License: MIT
85
49
  Private: false
86
50
  Repository: git+https://github.com/radix-ui/primitives.git
@@ -89,7 +53,7 @@ Homepage: https://radix-ui.com/primitives
89
53
  ---
90
54
 
91
55
  Name: @radix-ui/react-direction
92
- Version: 1.0.1
56
+ Version: 1.1.0
93
57
  License: MIT
94
58
  Private: false
95
59
  Repository: git+https://github.com/radix-ui/primitives.git
@@ -98,7 +62,7 @@ Homepage: https://radix-ui.com/primitives
98
62
  ---
99
63
 
100
64
  Name: @radix-ui/react-use-previous
101
- Version: 1.0.1
65
+ Version: 1.1.0
102
66
  License: MIT
103
67
  Private: false
104
68
  Repository: git+https://github.com/radix-ui/primitives.git
@@ -107,7 +71,7 @@ Homepage: https://radix-ui.com/primitives
107
71
  ---
108
72
 
109
73
  Name: @radix-ui/react-use-layout-effect
110
- Version: 1.0.1
74
+ Version: 1.1.0
111
75
  License: MIT
112
76
  Private: false
113
77
  Repository: git+https://github.com/radix-ui/primitives.git
@@ -116,7 +80,7 @@ Homepage: https://radix-ui.com/primitives
116
80
  ---
117
81
 
118
82
  Name: @radix-ui/react-use-size
119
- Version: 1.0.1
83
+ Version: 1.1.0
120
84
  License: MIT
121
85
  Private: false
122
86
  Repository: git+https://github.com/radix-ui/primitives.git
@@ -125,7 +89,7 @@ Homepage: https://radix-ui.com/primitives
125
89
  ---
126
90
 
127
91
  Name: @radix-ui/react-slot
128
- Version: 1.0.2
92
+ Version: 1.1.2
129
93
  License: MIT
130
94
  Private: false
131
95
  Repository: git+https://github.com/radix-ui/primitives.git
@@ -134,7 +98,7 @@ Homepage: https://radix-ui.com/primitives
134
98
  ---
135
99
 
136
100
  Name: @radix-ui/react-primitive
137
- Version: 1.0.3
101
+ Version: 2.0.2
138
102
  License: MIT
139
103
  Private: false
140
104
  Repository: git+https://github.com/radix-ui/primitives.git
@@ -143,7 +107,7 @@ Homepage: https://radix-ui.com/primitives
143
107
  ---
144
108
 
145
109
  Name: @radix-ui/react-collection
146
- Version: 1.0.3
110
+ Version: 1.1.2
147
111
  License: MIT
148
112
  Private: false
149
113
  Repository: git+https://github.com/radix-ui/primitives.git
@@ -152,7 +116,7 @@ Homepage: https://radix-ui.com/primitives
152
116
  ---
153
117
 
154
118
  Name: @radix-ui/react-slider
155
- Version: 1.1.2
119
+ Version: 1.2.3
156
120
  License: MIT
157
121
  Private: false
158
122
  Repository: git+https://github.com/radix-ui/primitives.git
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react/jsx-runtime"),r=require("react");require("react-dom");function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},_.apply(null,arguments)}function Z(e,[t,n]){return Math.min(n,Math.max(t,e))}function D(e,t,{checkForDefaultPrevented:n=!0}={}){return function(c){if(e==null||e(c),n===!1||!c.defaultPrevented)return t==null?void 0:t(c)}}function $e(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function J(...e){return t=>e.forEach(n=>$e(n,t))}function C(...e){return r.useCallback(J(...e),e)}function Q(e,t=[]){let n=[];function a(o,s){const i=r.createContext(s),u=n.length;n=[...n,s];function d(l){const{scope:f,children:h,...p}=l,$=(f==null?void 0:f[e][u])||i,m=r.useMemo(()=>p,Object.values(p));return r.createElement($.Provider,{value:m},h)}function S(l,f){const h=(f==null?void 0:f[e][u])||i,p=r.useContext(h);if(p)return p;if(s!==void 0)return s;throw new Error(`\`${l}\` must be used within \`${o}\``)}return d.displayName=o+"Provider",[d,S]}const c=()=>{const o=n.map(s=>r.createContext(s));return function(i){const u=(i==null?void 0:i[e])||o;return r.useMemo(()=>({[`__scope${e}`]:{...i,[e]:u}}),[i,u])}};return c.scopeName=e,[a,Se(c,...t)]}function Se(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(o){const s=a.reduce((i,{useScope:u,scopeName:d})=>{const l=u(o)[`__scope${d}`];return{...i,...l}},{});return r.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function ee(e){const t=r.useRef(e);return r.useEffect(()=>{t.current=e}),r.useMemo(()=>(...n)=>{var a;return(a=t.current)===null||a===void 0?void 0:a.call(t,...n)},[])}function he({prop:e,defaultProp:t,onChange:n=()=>{}}){const[a,c]=be({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:a,i=ee(n),u=r.useCallback(d=>{if(o){const l=typeof d=="function"?d(e):d;l!==e&&i(l)}else c(d)},[o,e,c,i]);return[s,u]}function be({defaultProp:e,onChange:t}){const n=r.useState(e),[a]=n,c=r.useRef(a),o=ee(t);return r.useEffect(()=>{c.current!==a&&(o(a),c.current=a)},[a,c,o]),n}const ve=r.createContext(void 0);function xe(e){const t=r.useContext(ve);return e||t||"ltr"}function ge(e){const t=r.useRef({value:e,previous:e});return r.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}const Ee=globalThis!=null&&globalThis.document?r.useLayoutEffect:()=>{};function _e(e){const[t,n]=r.useState(void 0);return Ee(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(c=>{if(!Array.isArray(c)||!c.length)return;const o=c[0];let s,i;if("borderBoxSize"in o){const u=o.borderBoxSize,d=Array.isArray(u)?u[0]:u;s=d.inlineSize,i=d.blockSize}else s=e.offsetWidth,i=e.offsetHeight;n({width:s,height:i})});return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}else n(void 0)},[e]),t}const k=r.forwardRef((e,t)=>{const{children:n,...a}=e,c=r.Children.toArray(n),o=c.find(ye);if(o){const s=o.props.children,i=c.map(u=>u===o?r.Children.count(s)>1?r.Children.only(null):r.isValidElement(s)?s.props.children:null:u);return r.createElement(j,_({},a,{ref:t}),r.isValidElement(s)?r.cloneElement(s,void 0,i):null)}return r.createElement(j,_({},a,{ref:t}),n)});k.displayName="Slot";const j=r.forwardRef((e,t)=>{const{children:n,...a}=e;return r.isValidElement(n)?r.cloneElement(n,{...Ce(a,n.props),ref:t?J(t,n.ref):n.ref}):r.Children.count(n)>1?r.Children.only(null):null});j.displayName="SlotClone";const we=({children:e})=>r.createElement(r.Fragment,null,e);function ye(e){return r.isValidElement(e)&&e.type===we}function Ce(e,t){const n={...t};for(const a in t){const c=e[a],o=t[a];/^on[A-Z]/.test(a)?c&&o?n[a]=(...i)=>{o(...i),c(...i)}:c&&(n[a]=c):a==="style"?n[a]={...c,...o}:a==="className"&&(n[a]=[c,o].filter(Boolean).join(" "))}return{...e,...n}}const Re=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],B=Re.reduce((e,t)=>{const n=r.forwardRef((a,c)=>{const{asChild:o,...s}=a,i=o?k:t;return r.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),r.createElement(i,_({},s,{ref:c}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Pe(e){const t=e+"CollectionProvider",[n,a]=Q(t),[c,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=h=>{const{scope:p,children:$}=h,m=r.useRef(null),v=r.useRef(new Map).current;return r.createElement(c,{scope:p,itemMap:v,collectionRef:m},$)},i=e+"CollectionSlot",u=r.forwardRef((h,p)=>{const{scope:$,children:m}=h,v=o(i,$),E=C(p,v.collectionRef);return r.createElement(k,{ref:E},m)}),d=e+"CollectionItemSlot",S="data-radix-collection-item",l=r.forwardRef((h,p)=>{const{scope:$,children:m,...v}=h,E=r.useRef(null),b=C(p,E),g=o(d,$);return r.useEffect(()=>(g.itemMap.set(E,{ref:E,...v}),()=>void g.itemMap.delete(E))),r.createElement(k,{[S]:"",ref:b},m)});function f(h){const p=o(e+"CollectionConsumer",h);return r.useCallback(()=>{const m=p.collectionRef.current;if(!m)return[];const v=Array.from(m.querySelectorAll(`[${S}]`));return Array.from(p.itemMap.values()).sort((g,R)=>v.indexOf(g.ref.current)-v.indexOf(R.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:s,Slot:u,ItemSlot:l},f,a]}const te=["PageUp","PageDown"],ne=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],oe={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},O="Slider",[H,Me,De]=Pe(O),[re,ct]=Q(O,[De]),[Ie,z]=re(O),Ae=r.forwardRef((e,t)=>{const{name:n,min:a=0,max:c=100,step:o=1,orientation:s="horizontal",disabled:i=!1,minStepsBetweenThumbs:u=0,defaultValue:d=[a],value:S,onValueChange:l=()=>{},onValueCommit:f=()=>{},inverted:h=!1,...p}=e,[$,m]=r.useState(null),v=C(t,x=>m(x)),E=r.useRef(new Set),b=r.useRef(0),g=s==="horizontal",R=$?!!$.closest("form"):!0,U=g?Oe:Te,[w=[],de]=he({prop:S,defaultProp:d,onChange:x=>{var y;(y=[...E.current][b.current])===null||y===void 0||y.focus(),l(x)}}),Y=r.useRef(w);function fe(x){const y=He(w,x);I(x,y)}function pe(x){I(x,b.current)}function me(){const x=Y.current[b.current];w[b.current]!==x&&f(w)}function I(x,y,{commit:T}={commit:!1}){const q=qe(o),L=We(Math.round((x-a)/o)*o+a,q),A=Z(L,[a,c]);de((M=[])=>{const P=Le(M,A,y);if(Ye(P,u*o)){b.current=P.indexOf(A);const W=String(P)!==String(M);return W&&T&&f(P),W?P:M}else return M})}return r.createElement(Ie,{scope:e.__scopeSlider,disabled:i,min:a,max:c,valueIndexToChangeRef:b,thumbs:E.current,values:w,orientation:s},r.createElement(H.Provider,{scope:e.__scopeSlider},r.createElement(H.Slot,{scope:e.__scopeSlider},r.createElement(U,_({"aria-disabled":i,"data-disabled":i?"":void 0},p,{ref:v,onPointerDown:D(p.onPointerDown,()=>{i||(Y.current=w)}),min:a,max:c,inverted:h,onSlideStart:i?void 0:fe,onSlideMove:i?void 0:pe,onSlideEnd:i?void 0:me,onHomeKeyDown:()=>!i&&I(a,0,{commit:!0}),onEndKeyDown:()=>!i&&I(c,w.length-1,{commit:!0}),onStepKeyDown:({event:x,direction:y})=>{if(!i){const L=te.includes(x.key)||x.shiftKey&&ne.includes(x.key)?10:1,A=b.current,M=w[A],P=o*L*y;I(M+P,A,{commit:!0})}}})))),R&&w.map((x,y)=>r.createElement(ze,{key:y,name:n?n+(w.length>1?"[]":""):void 0,value:x})))}),[ae,ce]=re(O,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Oe=r.forwardRef((e,t)=>{const{min:n,max:a,dir:c,inverted:o,onSlideStart:s,onSlideMove:i,onSlideEnd:u,onStepKeyDown:d,...S}=e,[l,f]=r.useState(null),h=C(t,b=>f(b)),p=r.useRef(),$=xe(c),m=$==="ltr",v=m&&!o||!m&&o;function E(b){const g=p.current||l.getBoundingClientRect(),R=[0,g.width],w=F(R,v?[n,a]:[a,n]);return p.current=g,w(b-g.left)}return r.createElement(ae,{scope:e.__scopeSlider,startEdge:v?"left":"right",endEdge:v?"right":"left",direction:v?1:-1,size:"width"},r.createElement(ie,_({dir:$,"data-orientation":"horizontal"},S,{ref:h,style:{...S.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:b=>{const g=E(b.clientX);s==null||s(g)},onSlideMove:b=>{const g=E(b.clientX);i==null||i(g)},onSlideEnd:()=>{p.current=void 0,u==null||u()},onStepKeyDown:b=>{const R=oe[v?"from-left":"from-right"].includes(b.key);d==null||d({event:b,direction:R?-1:1})}})))}),Te=r.forwardRef((e,t)=>{const{min:n,max:a,inverted:c,onSlideStart:o,onSlideMove:s,onSlideEnd:i,onStepKeyDown:u,...d}=e,S=r.useRef(null),l=C(t,S),f=r.useRef(),h=!c;function p($){const m=f.current||S.current.getBoundingClientRect(),v=[0,m.height],b=F(v,h?[a,n]:[n,a]);return f.current=m,b($-m.top)}return r.createElement(ae,{scope:e.__scopeSlider,startEdge:h?"bottom":"top",endEdge:h?"top":"bottom",size:"height",direction:h?1:-1},r.createElement(ie,_({"data-orientation":"vertical"},d,{ref:l,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:$=>{const m=p($.clientY);o==null||o(m)},onSlideMove:$=>{const m=p($.clientY);s==null||s(m)},onSlideEnd:()=>{f.current=void 0,i==null||i()},onStepKeyDown:$=>{const v=oe[h?"from-bottom":"from-top"].includes($.key);u==null||u({event:$,direction:v?-1:1})}})))}),ie=r.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:a,onSlideMove:c,onSlideEnd:o,onHomeKeyDown:s,onEndKeyDown:i,onStepKeyDown:u,...d}=e,S=z(O,n);return r.createElement(B.span,_({},d,{ref:t,onKeyDown:D(e.onKeyDown,l=>{l.key==="Home"?(s(l),l.preventDefault()):l.key==="End"?(i(l),l.preventDefault()):te.concat(ne).includes(l.key)&&(u(l),l.preventDefault())}),onPointerDown:D(e.onPointerDown,l=>{const f=l.target;f.setPointerCapture(l.pointerId),l.preventDefault(),S.thumbs.has(f)?f.focus():a(l)}),onPointerMove:D(e.onPointerMove,l=>{l.target.hasPointerCapture(l.pointerId)&&c(l)}),onPointerUp:D(e.onPointerUp,l=>{const f=l.target;f.hasPointerCapture(l.pointerId)&&(f.releasePointerCapture(l.pointerId),o(l))})}))}),Ne="SliderTrack",Ke=r.forwardRef((e,t)=>{const{__scopeSlider:n,...a}=e,c=z(Ne,n);return r.createElement(B.span,_({"data-disabled":c.disabled?"":void 0,"data-orientation":c.orientation},a,{ref:t}))}),X="SliderRange",Ve=r.forwardRef((e,t)=>{const{__scopeSlider:n,...a}=e,c=z(X,n),o=ce(X,n),s=r.useRef(null),i=C(t,s),u=c.values.length,d=c.values.map(f=>se(f,c.min,c.max)),S=u>1?Math.min(...d):0,l=100-Math.max(...d);return r.createElement(B.span,_({"data-orientation":c.orientation,"data-disabled":c.disabled?"":void 0},a,{ref:i,style:{...e.style,[o.startEdge]:S+"%",[o.endEdge]:l+"%"}}))}),G="SliderThumb",ke=r.forwardRef((e,t)=>{const n=Me(e.__scopeSlider),[a,c]=r.useState(null),o=C(t,i=>c(i)),s=r.useMemo(()=>a?n().findIndex(i=>i.ref.current===a):-1,[n,a]);return r.createElement(Be,_({},e,{ref:o,index:s}))}),Be=r.forwardRef((e,t)=>{const{__scopeSlider:n,index:a,...c}=e,o=z(G,n),s=ce(G,n),[i,u]=r.useState(null),d=C(t,m=>u(m)),S=_e(i),l=o.values[a],f=l===void 0?0:se(l,o.min,o.max),h=je(a,o.values.length),p=S==null?void 0:S[s.size],$=p?Fe(p,f,s.direction):0;return r.useEffect(()=>{if(i)return o.thumbs.add(i),()=>{o.thumbs.delete(i)}},[i,o.thumbs]),r.createElement("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[s.startEdge]:`calc(${f}% + ${$}px)`}},r.createElement(H.ItemSlot,{scope:e.__scopeSlider},r.createElement(B.span,_({role:"slider","aria-label":e["aria-label"]||h,"aria-valuemin":o.min,"aria-valuenow":l,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0},c,{ref:d,style:l===void 0?{display:"none"}:e.style,onFocus:D(e.onFocus,()=>{o.valueIndexToChangeRef.current=a})}))))}),ze=e=>{const{value:t,...n}=e,a=r.useRef(null),c=ge(t);return r.useEffect(()=>{const o=a.current,s=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(s,"value").set;if(c!==t&&u){const d=new Event("input",{bubbles:!0});u.call(o,t),o.dispatchEvent(d)}},[c,t]),r.createElement("input",_({style:{display:"none"}},n,{ref:a,defaultValue:t}))};function Le(e=[],t,n){const a=[...e];return a[n]=t,a.sort((c,o)=>c-o)}function se(e,t,n){const o=100/(n-t)*(e-t);return Z(o,[0,100])}function je(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function He(e,t){if(e.length===1)return 0;const n=e.map(c=>Math.abs(c-t)),a=Math.min(...n);return n.indexOf(a)}function Fe(e,t,n){const a=e/2,o=F([0,50],[0,a]);return(a-o(t)*n)*n}function Ue(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Ye(e,t){if(t>0){const n=Ue(e);return Math.min(...n)>=t}return!0}function F(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(n-e[0])}}function qe(e){return(String(e).split(".")[1]||"").length}function We(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}const Xe=Ae,Ge=Ke,Ze=Ve,Je=ke;function Qe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var le={exports:{}};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),R=require("react");require("react-dom");function xe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const a=xe(R);function Z(e,[t,n]){return Math.min(n,Math.max(t,e))}function A(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function G(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function J(...e){return t=>{let n=!1;const o=e.map(s=>{const r=G(s,t);return!n&&typeof r=="function"&&(n=!0),r});if(n)return()=>{for(let s=0;s<o.length;s++){const r=o[s];typeof r=="function"?r():G(e[s],null)}}}}function D(...e){return a.useCallback(J(...e),e)}function Q(e,t=[]){let n=[];function o(r,i){const c=a.createContext(i),u=n.length;n=[...n,i];const d=l=>{var p;const{scope:f,children:x,...h}=l,S=((p=f==null?void 0:f[e])==null?void 0:p[u])||c,g=a.useMemo(()=>h,Object.values(h));return m.jsx(S.Provider,{value:g,children:x})};d.displayName=r+"Provider";function y(l,f){var S;const x=((S=f==null?void 0:f[e])==null?void 0:S[u])||c,h=a.useContext(x);if(h)return h;if(i!==void 0)return i;throw new Error(`\`${l}\` must be used within \`${r}\``)}return[d,y]}const s=()=>{const r=n.map(i=>a.createContext(i));return function(c){const u=(c==null?void 0:c[e])||r;return a.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return s.scopeName=e,[o,be(s,...t)]}function be(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(r){const i=o.reduce((c,{useScope:u,scopeName:d})=>{const l=u(r)[`__scope${d}`];return{...c,...l}},{});return a.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function ee(e){const t=a.useRef(e);return a.useEffect(()=>{t.current=e}),a.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function ye({prop:e,defaultProp:t,onChange:n=()=>{}}){const[o,s]=ve({defaultProp:t,onChange:n}),r=e!==void 0,i=r?e:o,c=ee(n),u=a.useCallback(d=>{if(r){const l=typeof d=="function"?d(e):d;l!==e&&c(l)}else s(d)},[r,e,s,c]);return[i,u]}function ve({defaultProp:e,onChange:t}){const n=a.useState(e),[o]=n,s=a.useRef(o),r=ee(t);return a.useEffect(()=>{s.current!==o&&(r(o),s.current=o)},[o,s,r]),n}var we=a.createContext(void 0);function _e(e){const t=a.useContext(we);return e||t||"ltr"}function Re(e){const t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Ce=globalThis!=null&&globalThis.document?a.useLayoutEffect:()=>{};function Pe(e){const[t,n]=a.useState(void 0);return Ce(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const r=s[0];let i,c;if("borderBoxSize"in r){const u=r.borderBoxSize,d=Array.isArray(u)?u[0]:u;i=d.inlineSize,c=d.blockSize}else i=e.offsetWidth,c=e.offsetHeight;n({width:i,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var k=a.forwardRef((e,t)=>{const{children:n,...o}=e,s=a.Children.toArray(n),r=s.find(De);if(r){const i=r.props.children,c=s.map(u=>u===r?a.Children.count(i)>1?a.Children.only(null):a.isValidElement(i)?i.props.children:null:u);return m.jsx(F,{...o,ref:t,children:a.isValidElement(i)?a.cloneElement(i,void 0,c):null})}return m.jsx(F,{...o,ref:t,children:n})});k.displayName="Slot";var F=a.forwardRef((e,t)=>{const{children:n,...o}=e;if(a.isValidElement(n)){const s=je(n),r=Me(o,n.props);return n.type!==a.Fragment&&(r.ref=t?J(t,s):s),a.cloneElement(n,r)}return a.Children.count(n)>1?a.Children.only(null):null});F.displayName="SlotClone";var Ee=({children:e})=>m.jsx(m.Fragment,{children:e});function De(e){return a.isValidElement(e)&&e.type===Ee}function Me(e,t){const n={...t};for(const o in t){const s=e[o],r=t[o];/^on[A-Z]/.test(o)?s&&r?n[o]=(...c)=>{r(...c),s(...c)}:s&&(n[o]=s):o==="style"?n[o]={...s,...r}:o==="className"&&(n[o]=[s,r].filter(Boolean).join(" "))}return{...e,...n}}function je(e){var o,s;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ae=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],z=Ae.reduce((e,t)=>{const n=a.forwardRef((o,s)=>{const{asChild:r,...i}=o,c=r?k:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(c,{...i,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Ie(e){const t=e+"CollectionProvider",[n,o]=Q(t),[s,r]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=x=>{const{scope:h,children:S}=x,g=R.useRef(null),p=R.useRef(new Map).current;return m.jsx(s,{scope:h,itemMap:p,collectionRef:g,children:S})};i.displayName=t;const c=e+"CollectionSlot",u=R.forwardRef((x,h)=>{const{scope:S,children:g}=x,p=r(c,S),w=D(h,p.collectionRef);return m.jsx(k,{ref:w,children:g})});u.displayName=c;const d=e+"CollectionItemSlot",y="data-radix-collection-item",l=R.forwardRef((x,h)=>{const{scope:S,children:g,...p}=x,w=R.useRef(null),v=D(h,w),b=r(d,S);return R.useEffect(()=>(b.itemMap.set(w,{ref:w,...p}),()=>void b.itemMap.delete(w))),m.jsx(k,{[y]:"",ref:v,children:g})});l.displayName=d;function f(x){const h=r(e+"CollectionConsumer",x);return R.useCallback(()=>{const g=h.collectionRef.current;if(!g)return[];const p=Array.from(g.querySelectorAll(`[${y}]`));return Array.from(h.itemMap.values()).sort((b,C)=>p.indexOf(b.ref.current)-p.indexOf(C.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:i,Slot:u,ItemSlot:l},f,o]}var te=["PageUp","PageDown"],ne=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],re={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},I="Slider",[H,Ne,Oe]=Ie(I),[oe,st]=Q(I,[Oe]),[Te,B]=oe(I),se=a.forwardRef((e,t)=>{const{name:n,min:o=0,max:s=100,step:r=1,orientation:i="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:d=[o],value:y,onValueChange:l=()=>{},onValueCommit:f=()=>{},inverted:x=!1,form:h,...S}=e,g=a.useRef(new Set),p=a.useRef(0),v=i==="horizontal"?Ve:ke,[b=[],C]=ye({prop:y,defaultProp:d,onChange:_=>{var M;(M=[...g.current][p.current])==null||M.focus(),l(_)}}),K=a.useRef(b);function L(_){const P=$e(b,_);N(_,P)}function Se(_){N(_,p.current)}function ge(){const _=K.current[p.current];b[p.current]!==_&&f(b)}function N(_,P,{commit:M}={commit:!1}){const q=Ue(r),$=Ye(Math.round((_-o)/r)*r+o,q),O=Z($,[o,s]);C((j=[])=>{const E=Ke(j,O,P);if(We(E,u*r)){p.current=E.indexOf(O);const X=String(E)!==String(j);return X&&M&&f(E),X?E:j}else return j})}return m.jsx(Te,{scope:e.__scopeSlider,name:n,disabled:c,min:o,max:s,valueIndexToChangeRef:p,thumbs:g.current,values:b,orientation:i,form:h,children:m.jsx(H.Provider,{scope:e.__scopeSlider,children:m.jsx(H.Slot,{scope:e.__scopeSlider,children:m.jsx(v,{"aria-disabled":c,"data-disabled":c?"":void 0,...S,ref:t,onPointerDown:A(S.onPointerDown,()=>{c||(K.current=b)}),min:o,max:s,inverted:x,onSlideStart:c?void 0:L,onSlideMove:c?void 0:Se,onSlideEnd:c?void 0:ge,onHomeKeyDown:()=>!c&&N(o,0,{commit:!0}),onEndKeyDown:()=>!c&&N(s,b.length-1,{commit:!0}),onStepKeyDown:({event:_,direction:P})=>{if(!c){const $=te.includes(_.key)||_.shiftKey&&ne.includes(_.key)?10:1,O=p.current,j=b[O],E=r*$*P;N(j+E,O,{commit:!0})}}})})})})});se.displayName=I;var[ie,ce]=oe(I,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Ve=a.forwardRef((e,t)=>{const{min:n,max:o,dir:s,inverted:r,onSlideStart:i,onSlideMove:c,onSlideEnd:u,onStepKeyDown:d,...y}=e,[l,f]=a.useState(null),x=D(t,v=>f(v)),h=a.useRef(void 0),S=_e(s),g=S==="ltr",p=g&&!r||!g&&r;function w(v){const b=h.current||l.getBoundingClientRect(),C=[0,b.width],L=Y(C,p?[n,o]:[o,n]);return h.current=b,L(v-b.left)}return m.jsx(ie,{scope:e.__scopeSlider,startEdge:p?"left":"right",endEdge:p?"right":"left",direction:p?1:-1,size:"width",children:m.jsx(ae,{dir:S,"data-orientation":"horizontal",...y,ref:x,style:{...y.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:v=>{const b=w(v.clientX);i==null||i(b)},onSlideMove:v=>{const b=w(v.clientX);c==null||c(b)},onSlideEnd:()=>{h.current=void 0,u==null||u()},onStepKeyDown:v=>{const C=re[p?"from-left":"from-right"].includes(v.key);d==null||d({event:v,direction:C?-1:1})}})})}),ke=a.forwardRef((e,t)=>{const{min:n,max:o,inverted:s,onSlideStart:r,onSlideMove:i,onSlideEnd:c,onStepKeyDown:u,...d}=e,y=a.useRef(null),l=D(t,y),f=a.useRef(void 0),x=!s;function h(S){const g=f.current||y.current.getBoundingClientRect(),p=[0,g.height],v=Y(p,x?[o,n]:[n,o]);return f.current=g,v(S-g.top)}return m.jsx(ie,{scope:e.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:m.jsx(ae,{"data-orientation":"vertical",...d,ref:l,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:S=>{const g=h(S.clientY);r==null||r(g)},onSlideMove:S=>{const g=h(S.clientY);i==null||i(g)},onSlideEnd:()=>{f.current=void 0,c==null||c()},onStepKeyDown:S=>{const p=re[x?"from-bottom":"from-top"].includes(S.key);u==null||u({event:S,direction:p?-1:1})}})})}),ae=a.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:o,onSlideMove:s,onSlideEnd:r,onHomeKeyDown:i,onEndKeyDown:c,onStepKeyDown:u,...d}=e,y=B(I,n);return m.jsx(z.span,{...d,ref:t,onKeyDown:A(e.onKeyDown,l=>{l.key==="Home"?(i(l),l.preventDefault()):l.key==="End"?(c(l),l.preventDefault()):te.concat(ne).includes(l.key)&&(u(l),l.preventDefault())}),onPointerDown:A(e.onPointerDown,l=>{const f=l.target;f.setPointerCapture(l.pointerId),l.preventDefault(),y.thumbs.has(f)?f.focus():o(l)}),onPointerMove:A(e.onPointerMove,l=>{l.target.hasPointerCapture(l.pointerId)&&s(l)}),onPointerUp:A(e.onPointerUp,l=>{const f=l.target;f.hasPointerCapture(l.pointerId)&&(f.releasePointerCapture(l.pointerId),r(l))})})}),le="SliderTrack",ue=a.forwardRef((e,t)=>{const{__scopeSlider:n,...o}=e,s=B(le,n);return m.jsx(z.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...o,ref:t})});ue.displayName=le;var W="SliderRange",de=a.forwardRef((e,t)=>{const{__scopeSlider:n,...o}=e,s=B(W,n),r=ce(W,n),i=a.useRef(null),c=D(t,i),u=s.values.length,d=s.values.map(f=>pe(f,s.min,s.max)),y=u>1?Math.min(...d):0,l=100-Math.max(...d);return m.jsx(z.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...o,ref:c,style:{...e.style,[r.startEdge]:y+"%",[r.endEdge]:l+"%"}})});de.displayName=W;var U="SliderThumb",fe=a.forwardRef((e,t)=>{const n=Ne(e.__scopeSlider),[o,s]=a.useState(null),r=D(t,c=>s(c)),i=a.useMemo(()=>o?n().findIndex(c=>c.ref.current===o):-1,[n,o]);return m.jsx(ze,{...e,ref:r,index:i})}),ze=a.forwardRef((e,t)=>{const{__scopeSlider:n,index:o,name:s,...r}=e,i=B(U,n),c=ce(U,n),[u,d]=a.useState(null),y=D(t,w=>d(w)),l=u?i.form||!!u.closest("form"):!0,f=Pe(u),x=i.values[o],h=x===void 0?0:pe(x,i.min,i.max),S=Le(o,i.values.length),g=f==null?void 0:f[c.size],p=g?Fe(g,h,c.direction):0;return a.useEffect(()=>{if(u)return i.thumbs.add(u),()=>{i.thumbs.delete(u)}},[u,i.thumbs]),m.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${h}% + ${p}px)`},children:[m.jsx(H.ItemSlot,{scope:e.__scopeSlider,children:m.jsx(z.span,{role:"slider","aria-label":e["aria-label"]||S,"aria-valuemin":i.min,"aria-valuenow":x,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...r,ref:y,style:x===void 0?{display:"none"}:e.style,onFocus:A(e.onFocus,()=>{i.valueIndexToChangeRef.current=o})})}),l&&m.jsx(Be,{name:s??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:x},o)]})});fe.displayName=U;var Be=e=>{const{value:t,...n}=e,o=a.useRef(null),s=Re(t);return a.useEffect(()=>{const r=o.current,i=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(i,"value").set;if(s!==t&&u){const d=new Event("input",{bubbles:!0});u.call(r,t),r.dispatchEvent(d)}},[s,t]),m.jsx("input",{style:{display:"none"},...n,ref:o,defaultValue:t})};function Ke(e=[],t,n){const o=[...e];return o[n]=t,o.sort((s,r)=>s-r)}function pe(e,t,n){const r=100/(n-t)*(e-t);return Z(r,[0,100])}function Le(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function $e(e,t){if(e.length===1)return 0;const n=e.map(s=>Math.abs(s-t)),o=Math.min(...n);return n.indexOf(o)}function Fe(e,t,n){const o=e/2,r=Y([0,50],[0,o]);return(o-r(t)*n)*n}function He(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function We(e,t){if(t>0){const n=He(e);return Math.min(...n)>=t}return!0}function Y(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const o=(t[1]-t[0])/(e[1]-e[0]);return t[0]+o*(n-e[0])}}function Ue(e){return(String(e).split(".")[1]||"").length}function Ye(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var qe=se,Xe=ue,Ge=de,Ze=fe;function Je(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var me={exports:{}};/*!
2
2
  Copyright (c) 2018 Jed Watson.
3
3
  Licensed under the MIT License (MIT), see
4
4
  http://jedwatson.github.io/classnames
5
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o="",s=0;s<arguments.length;s++){var i=arguments[s];i&&(o=c(o,a.call(this,i)))}return o}function a(o){if(typeof o=="string"||typeof o=="number")return this&&this[o]||o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(this,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var s="";for(var i in o)t.call(o,i)&&o[i]&&(s=c(s,this&&this[i]||i));return s}function c(o,s){return s?o?o+" "+s:o+s:o}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(le);var et=le.exports;const tt=Qe(et),nt={"purpur-slider":"_purpur-slider_14tuk_1","purpur-slider__track":"_purpur-slider__track_14tuk_17","purpur-slider__range":"_purpur-slider__range_14tuk_17","purpur-slider__thumb":"_purpur-slider__thumb_14tuk_43"},K=tt.bind(nt),ot=["horizontal","vertical"],V="purpur-slider",rt=e=>String(e),at=({"aria-label":e,"aria-valuetext":t,className:n,defaultValue:a,id:c,value:o,...s},i)=>{const u=r.useId(),d=o||a;return N.jsxs(Xe,{...s,id:c||u,ref:i,className:K(V,n),value:o,defaultValue:a,children:[N.jsx(Ge,{className:K(`${V}__track`),children:N.jsx(Ze,{className:K(`${V}__range`)})}),d==null?void 0:d.map((S,l)=>N.jsx(Je,{className:K(`${V}__thumb`),"aria-label":e,"aria-valuetext":t},rt(l)))]})},ue=r.forwardRef(at);ue.displayName="Slider";exports.SLIDER_ORIENTATION=ot;exports.Slider=ue;
5
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r="",i=0;i<arguments.length;i++){var c=arguments[i];c&&(r=s(r,o.call(this,c)))}return r}function o(r){if(typeof r=="string"||typeof r=="number")return this&&this[r]||r;if(typeof r!="object")return"";if(Array.isArray(r))return n.apply(this,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var i="";for(var c in r)t.call(r,c)&&r[c]&&(i=s(i,this&&this[c]||c));return i}function s(r,i){return i?r?r+" "+i:r+i:r}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(me);var Qe=me.exports;const et=Je(Qe),tt={"purpur-slider":"_purpur-slider_14tuk_1","purpur-slider__track":"_purpur-slider__track_14tuk_17","purpur-slider__range":"_purpur-slider__range_14tuk_17","purpur-slider__thumb":"_purpur-slider__thumb_14tuk_43"},T=et.bind(tt),nt=["horizontal","vertical"],V="purpur-slider",rt=e=>String(e),ot=({"aria-label":e,"aria-valuetext":t,className:n,defaultValue:o,id:s,value:r,...i},c)=>{const u=R.useId(),d=r||o;return m.jsxs(qe,{...i,id:s||u,ref:c,className:T(V,n),value:r,defaultValue:o,children:[m.jsx(Xe,{className:T(`${V}__track`),children:m.jsx(Ge,{className:T(`${V}__range`)})}),d==null?void 0:d.map((y,l)=>m.jsx(Ze,{className:T(`${V}__thumb`),"aria-label":e,"aria-valuetext":t},rt(l)))]})},he=R.forwardRef(ot);he.displayName="Slider";exports.SLIDER_ORIENTATION=nt;exports.Slider=he;
6
6
  //# sourceMappingURL=slider.cjs.js.map