New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@spark-ui/rating

Package Overview
Dependencies
Maintainers
0
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spark-ui/rating - npm Package Compare versions

Comparing version 7.3.7 to 8.0.0

4

CHANGELOG.md

@@ -6,2 +6,6 @@ # Change Log

# [8.0.0](https://github.com/adevinta/spark/compare/v7.3.7...v8.0.0) (2025-01-13)
**Note:** Version bump only for package @spark-ui/rating
## [7.3.7](https://github.com/adevinta/spark/compare/v7.3.6...v7.3.7) (2025-01-08)

@@ -8,0 +12,0 @@

2

dist/index.js

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

"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),nt=require("class-variance-authority"),_e=require("@spark-ui/icon");var Rt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qe(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var qt={exports:{}};(function(o,v){var g="__lodash_hash_undefined__",m=9007199254740991,j="[object Arguments]",E="[object Array]",J="[object Boolean]",pt="[object Date]",ht="[object Error]",vt="[object Function]",K="[object Map]",P="[object Number]",A="[object Object]",Q="[object Promise]",at="[object RegExp]",$="[object Set]",X="[object String]",Ct="[object Symbol]",_="[object WeakMap]",w="[object ArrayBuffer]",O="[object DataView]",R=/^\[object .+?Constructor\]$/,ot=/^(?:0|[1-9]\d*)$/,i={};i["[object Float32Array]"]=i["[object Float64Array]"]=i["[object Int8Array]"]=i["[object Int16Array]"]=i["[object Int32Array]"]=i["[object Uint8Array]"]=i["[object Uint8ClampedArray]"]=i["[object Uint16Array]"]=i["[object Uint32Array]"]=!0,i[j]=i[E]=i[w]=i[J]=i[O]=i[pt]=i[ht]=i[vt]=i[K]=i[P]=i[A]=i[at]=i[$]=i[X]=i[_]=!1;var Y=typeof Rt=="object"&&Rt&&Rt.Object===Object&&Rt,S=typeof self=="object"&&self&&self.Object===Object&&self,y=Y||S||Function("return this")(),x=v&&!v.nodeType&&v,_t=x&&o&&!o.nodeType&&o,B=_t&&_t.exports===x,it=B&&Y.process,Dt=function(){try{return it&&it.binding&&it.binding("util")}catch{}}(),Ht=Dt&&Dt.isTypedArray;function je(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function we(t){var e=-1,r=Array(t.size);return t.forEach(function(n,s){r[++e]=[s,n]}),r}function Oe(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Wt,Gt,Jt,xe=Array.prototype,ze=Function.prototype,yt=Object.prototype,Tt=y["__core-js_shared__"],Kt=ze.toString,N=yt.hasOwnProperty,Qt=(Wt=/[^.]+$/.exec(Tt&&Tt.keys&&Tt.keys.IE_PROTO||""))?"Symbol(src)_1."+Wt:"",Xt=yt.toString,Ae=RegExp("^"+Kt.call(N).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Yt=B?y.Buffer:void 0,bt=y.Symbol,te=y.Uint8Array,ee=yt.propertyIsEnumerable,ke=xe.splice,q=bt?bt.toStringTag:void 0,re=Object.getOwnPropertySymbols,Ee=Yt?Yt.isBuffer:void 0,Se=(Gt=Object.keys,Jt=Object,function(t){return Gt(Jt(t))}),It=tt(y,"DataView"),ct=tt(y,"Map"),Ft=tt(y,"Promise"),Pt=tt(y,"Set"),$t=tt(y,"WeakMap"),ut=tt(Object,"create"),Ne=W(It),Me=W(ct),Re=W(Ft),Ce=W(Pt),Te=W($t),ne=bt?bt.prototype:void 0,Bt=ne?ne.valueOf:void 0;function D(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function C(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function H(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function gt(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new H;++e<r;)this.add(t[e])}function L(t){var e=this.__data__=new C(t);this.size=e.size}function Ie(t,e){var r=wt(t),n=!r&&Le(t),s=!r&&!n&&Lt(t),a=!r&&!n&&!s&&de(t),f=r||n||s||a,d=f?function(h,M){for(var T=-1,b=Array(h);++T<h;)b[T]=M(T);return b}(t.length,String):[],k=d.length;for(var p in t)!e&&!N.call(t,p)||f&&(p=="length"||s&&(p=="offset"||p=="parent")||a&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||Be(p,k))||d.push(p);return d}function mt(t,e){for(var r=t.length;r--;)if(ue(t[r][0],e))return r;return-1}function st(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":q&&q in Object(t)?function(e){var r=N.call(e,q),n=e[q];try{e[q]=void 0;var s=!0}catch{}var a=Xt.call(e);return s&&(r?e[q]=n:delete e[q]),a}(t):function(e){return Xt.call(e)}(t)}function ae(t){return lt(t)&&st(t)==j}function oe(t,e,r,n,s){return t===e||(t==null||e==null||!lt(t)&&!lt(e)?t!=t&&e!=e:function(a,f,d,k,p,h){var M=wt(a),T=wt(f),b=M?E:U(a),I=T?E:U(f),et=(b=b==j?A:b)==A,Ot=(I=I==j?A:I)==A,rt=b==I;if(rt&&Lt(a)){if(!Lt(f))return!1;M=!0,et=!1}if(rt&&!et)return h||(h=new L),M||de(a)?ie(a,f,d,k,p,h):function(u,c,xt,V,Ut,z,F){switch(xt){case O:if(u.byteLength!=c.byteLength||u.byteOffset!=c.byteOffset)return!1;u=u.buffer,c=c.buffer;case w:return!(u.byteLength!=c.byteLength||!z(new te(u),new te(c)));case J:case pt:case P:return ue(+u,+c);case ht:return u.name==c.name&&u.message==c.message;case at:case X:return u==c+"";case K:var Z=we;case $:var dt=1&V;if(Z||(Z=Oe),u.size!=c.size&&!dt)return!1;var zt=F.get(u);if(zt)return zt==c;V|=2,F.set(u,c);var Vt=ie(Z(u),Z(c),V,Ut,z,F);return F.delete(u),Vt;case Ct:if(Bt)return Bt.call(u)==Bt.call(c)}return!1}(a,f,b,d,k,p,h);if(!(1&d)){var ft=et&&N.call(a,"__wrapped__"),pe=Ot&&N.call(f,"__wrapped__");if(ft||pe){var Ve=ft?a.value():a,Ze=pe?f.value():f;return h||(h=new L),p(Ve,Ze,d,k,h)}}return rt?(h||(h=new L),function(u,c,xt,V,Ut,z){var F=1&xt,Z=ce(u),dt=Z.length,zt=ce(c),Vt=zt.length;if(dt!=Vt&&!F)return!1;for(var At=dt;At--;){var G=Z[At];if(!(F?G in c:N.call(c,G)))return!1}var he=z.get(u);if(he&&z.get(c))return he==c;var kt=!0;z.set(u,c),z.set(c,u);for(var Zt=F;++At<dt;){var Et=u[G=Z[At]],St=c[G];if(V)var ve=F?V(St,Et,G,c,u,z):V(Et,St,G,u,c,z);if(!(ve===void 0?Et===St||Ut(Et,St,xt,V,z):ve)){kt=!1;break}Zt||(Zt=G=="constructor")}if(kt&&!Zt){var Nt=u.constructor,Mt=c.constructor;Nt==Mt||!("constructor"in u)||!("constructor"in c)||typeof Nt=="function"&&Nt instanceof Nt&&typeof Mt=="function"&&Mt instanceof Mt||(kt=!1)}return z.delete(u),z.delete(c),kt}(a,f,d,k,p,h)):!1}(t,e,r,n,oe,s))}function Fe(t){return!(!fe(t)||function(e){return!!Qt&&Qt in e}(t))&&(se(t)?Ae:R).test(W(t))}function Pe(t){if(r=(e=t)&&e.constructor,n=typeof r=="function"&&r.prototype||yt,e!==n)return Se(t);var e,r,n,s=[];for(var a in Object(t))N.call(t,a)&&a!="constructor"&&s.push(a);return s}function ie(t,e,r,n,s,a){var f=1&r,d=t.length,k=e.length;if(d!=k&&!(f&&k>d))return!1;var p=a.get(t);if(p&&a.get(e))return p==e;var h=-1,M=!0,T=2&r?new gt:void 0;for(a.set(t,e),a.set(e,t);++h<d;){var b=t[h],I=e[h];if(n)var et=f?n(I,b,h,e,t,a):n(b,I,h,t,e,a);if(et!==void 0){if(et)continue;M=!1;break}if(T){if(!je(e,function(Ot,rt){if(ft=rt,!T.has(ft)&&(b===Ot||s(b,Ot,r,n,a)))return T.push(rt);var ft})){M=!1;break}}else if(b!==I&&!s(b,I,r,n,a)){M=!1;break}}return a.delete(t),a.delete(e),M}function ce(t){return function(e,r,n){var s=r(e);return wt(e)?s:function(a,f){for(var d=-1,k=f.length,p=a.length;++d<k;)a[p+d]=f[d];return a}(s,n(e))}(t,Ue,$e)}function jt(t,e){var r,n,s=t.__data__;return((n=typeof(r=e))=="string"||n=="number"||n=="symbol"||n=="boolean"?r!=="__proto__":r===null)?s[typeof e=="string"?"string":"hash"]:s.map}function tt(t,e){var r=function(n,s){return n?.[s]}(t,e);return Fe(r)?r:void 0}D.prototype.clear=function(){this.__data__=ut?ut(null):{},this.size=0},D.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},D.prototype.get=function(t){var e=this.__data__;if(ut){var r=e[t];return r===g?void 0:r}return N.call(e,t)?e[t]:void 0},D.prototype.has=function(t){var e=this.__data__;return ut?e[t]!==void 0:N.call(e,t)},D.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ut&&e===void 0?g:e,this},C.prototype.clear=function(){this.__data__=[],this.size=0},C.prototype.delete=function(t){var e=this.__data__,r=mt(e,t);return!(r<0)&&(r==e.length-1?e.pop():ke.call(e,r,1),--this.size,!0)},C.prototype.get=function(t){var e=this.__data__,r=mt(e,t);return r<0?void 0:e[r][1]},C.prototype.has=function(t){return mt(this.__data__,t)>-1},C.prototype.set=function(t,e){var r=this.__data__,n=mt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},H.prototype.clear=function(){this.size=0,this.__data__={hash:new D,map:new(ct||C),string:new D}},H.prototype.delete=function(t){var e=jt(this,t).delete(t);return this.size-=e?1:0,e},H.prototype.get=function(t){return jt(this,t).get(t)},H.prototype.has=function(t){return jt(this,t).has(t)},H.prototype.set=function(t,e){var r=jt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},gt.prototype.add=gt.prototype.push=function(t){return this.__data__.set(t,g),this},gt.prototype.has=function(t){return this.__data__.has(t)},L.prototype.clear=function(){this.__data__=new C,this.size=0},L.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},L.prototype.get=function(t){return this.__data__.get(t)},L.prototype.has=function(t){return this.__data__.has(t)},L.prototype.set=function(t,e){var r=this.__data__;if(r instanceof C){var n=r.__data__;if(!ct||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new H(n)}return r.set(t,e),this.size=r.size,this};var $e=re?function(t){return t==null?[]:(t=Object(t),function(e,r){for(var n=-1,s=e==null?0:e.length,a=0,f=[];++n<s;){var d=e[n];r(d,n,e)&&(f[a++]=d)}return f}(re(t),function(e){return ee.call(t,e)}))}:function(){return[]},U=st;function Be(t,e){return!!(e=e??m)&&(typeof t=="number"||ot.test(t))&&t>-1&&t%1==0&&t<e}function W(t){if(t!=null){try{return Kt.call(t)}catch{}try{return t+""}catch{}}return""}function ue(t,e){return t===e||t!=t&&e!=e}(It&&U(new It(new ArrayBuffer(1)))!=O||ct&&U(new ct)!=K||Ft&&U(Ft.resolve())!=Q||Pt&&U(new Pt)!=$||$t&&U(new $t)!=_)&&(U=function(t){var e=st(t),r=e==A?t.constructor:void 0,n=r?W(r):"";if(n)switch(n){case Ne:return O;case Me:return K;case Re:return Q;case Ce:return $;case Te:return _}return e});var Le=ae(function(){return arguments}())?ae:function(t){return lt(t)&&N.call(t,"callee")&&!ee.call(t,"callee")},wt=Array.isArray,Lt=Ee||function(){return!1};function se(t){if(!fe(t))return!1;var e=st(t);return e==vt||e=="[object GeneratorFunction]"||e=="[object AsyncFunction]"||e=="[object Proxy]"}function le(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=m}function fe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function lt(t){return t!=null&&typeof t=="object"}var de=Ht?function(t){return function(e){return t(e)}}(Ht):function(t){return lt(t)&&le(t.length)&&!!i[st(t)]};function Ue(t){return(e=t)!=null&&le(e.length)&&!se(e)?Ie(t):Pe(t);var e}o.exports=function(t,e){return oe(t,e)}})(qt,qt.exports);const De=qe(qt.exports),be=l.forwardRef(({title:o,fill:v="currentColor",stroke:g="none",...m},j)=>l.createElement("svg",{ref:j,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"StarFill",...o&&{"data-title":o},fill:v,stroke:g,...m,dangerouslySetInnerHTML:{__html:(o===void 0?"":`<title>${o}</title>`)+'<path d="m11.04,2.25c-.25.17-.5.42-.67.75l-2.08,4.58-4.74.67c-.33,0-.58.17-.91.33-.25.25-.5.5-.58.83-.08.42-.08.75,0,1.08.08.33.25.67.5.92l3.49,3.49-.83,4.99c-.08.33,0,.67.08,1,.08.33.33.58.58.75.25.17.58.33.91.33s.67-.08.91-.17l4.32-2.33,4.32,2.33c.25.17.58.25.91.17.33,0,.67-.17.91-.33.25-.17.5-.5.58-.75.08-.33.17-.67.08-1l-.83-4.99,3.41-3.58c.25-.25.42-.5.5-.83.08-.33.08-.67,0-1-.08-.33-.25-.58-.5-.83-.25-.25-.58-.33-.83-.42l-4.74-.75-2.16-4.49c-.17-.33-.33-.58-.67-.75-.25-.17-.5-.25-.75-.25h-.33c-.42.08-.67.17-.91.25Z"/>'}}));be.displayName="StarFill";const ge=l.forwardRef(({title:o,fill:v="currentColor",stroke:g="none",...m},j)=>l.createElement("svg",{ref:j,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"StarOutline",...o&&{"data-title":o},fill:v,stroke:g,...m,dangerouslySetInnerHTML:{__html:(o===void 0?"":`<title>${o}</title>`)+'<path fill-rule="evenodd" d="m12.02,4.31l-2.01,4.22c-.12.27-.3.5-.53.68-.23.18-.5.29-.79.32l-4.47.69,3.24,3.24c.21.2.36.45.45.73.09.28.11.58.06.87h0s-.78,4.73-.78,4.73l4.03-2.21s.02,0,.03-.01c.25-.13.52-.19.79-.19s.55.07.79.19c0,0,.02,0,.03.01l4.02,2.21-.78-4.66h0c-.05-.29-.03-.59.06-.87.09-.28.24-.52.44-.72l3.21-3.31-4.45-.68c-.28-.04-.56-.15-.79-.32-.23-.18-.41-.41-.53-.68l-2.01-4.22Zm4.91,15.92h0s0,0,0,0ZM11.09,2.28c.28-.18.6-.28.93-.28s.65.1.93.28c.27.18.49.44.63.74l2.16,4.53,4.77.73c.32.05.62.18.87.4.25.22.44.5.54.83.1.32.11.67.03,1-.08.32-.25.62-.48.85l-3.44,3.55.83,4.98c.06.33.02.68-.1.99-.12.31-.33.58-.59.78s-.58.32-.9.34c-.32.02-.65-.05-.94-.21h0s-4.3-2.36-4.3-2.36l-4.3,2.36h0c-.29.16-.61.23-.94.21-.32-.02-.64-.14-.9-.34s-.47-.47-.59-.78c-.12-.31-.16-.65-.1-.99h0s.83-5.04.83-5.04l-3.48-3.49c-.24-.24-.41-.54-.49-.88-.08-.34-.06-.69.05-1.02.11-.33.31-.61.58-.82.25-.2.56-.33.88-.36l4.75-.73,2.16-4.53c.14-.3.36-.56.63-.74Z"/>'}}));ge.displayName="StarOutline";const He=nt.cx("peer-hover:[&_>_div]:!w-none"),We=nt.cva(["peer","after:inset-none","group","relative","after:block after:absolute"],{variants:{disabled:{true:"opacity-dim-3",false:""},readOnly:{true:"",false:""},gap:{sm:["after:w-[calc(100%_+_theme(spacing.sm))]","last-of-type:after:content-none"],md:["after:w-[calc(100%_+_theme(spacing.md))]","last-of-type:after:content-none"]}},compoundVariants:[{readOnly:!1,disabled:!1,className:nt.cx(He,"cursor-pointer")}],defaultVariants:{disabled:!1,readOnly:!1,gap:"sm"}}),ye=nt.cva("",{variants:{size:{sm:"text-caption-link",md:"text-body-1",lg:"text-display-1"},design:{filled:["text-main-variant","group-[[data-part=star][data-hovered]]:text-main-variant-hovered"],outlined:["text-on-surface/dim-3"]}}}),Ge=l.forwardRef(({value:o,size:v,disabled:g,readOnly:m,onClick:j,onMouseEnter:E},J)=>l.createElement("div",{ref:J,onMouseEnter:E,className:We({gap:v==="lg"?"md":"sm",disabled:g,readOnly:m}),"data-part":"star",onClick:j},l.createElement("div",{className:nt.cx("absolute z-raised overflow-hidden","group-[[data-part=star][data-hovered]]:overflow-visible"),style:{width:100*o+"%"}},l.createElement(_e.Icon,{className:ye({size:v,design:"filled"})},l.createElement(be,null))),l.createElement(_e.Icon,{className:ye({size:v,design:"outlined"})},l.createElement(ge,null))));function me(o){return .5*Math.round(o/.5)}function Je({value:o,index:v}){if(o===void 0)return 0;const g=v+1,m=me(o);return Math.ceil(m)<g?0:m>=g?1:.5}const Ke=l.forwardRef(({defaultValue:o,value:v,onValueChange:g,size:m="md",disabled:j,readOnly:E,name:J,id:pt,"aria-label":ht,...vt},K)=>{const P=l.useRef(null),A=l.useRef([]),[Q,at]=function(_,w,O){const R=_!==void 0,{current:ot}=l.useRef(R?_:w),[i,Y]=l.useState(w),S=R?_:i,y=l.useCallback((x,_t=(B,it)=>!De(B,it))=>{const B=typeof x!="function"?x:x(S);_t(S,B)&&!R&&Y(B),O&&O(B)},[R,S,O]);return[S,y,R,ot]}(v,o,g),$=l.useRef(Q),X=!(j||E),Ct=l.useCallback(_=>{_&&A.current.push(_)},[]);return l.createElement("div",{className:"relative inline-flex",ref:K,"data-spark-component":"rating",...vt,onMouseLeave:function(){A.current.forEach(_=>_.removeAttribute("data-hovered"))}},l.createElement("input",{name:J,id:pt,"aria-label":ht,ref:P,"data-part":"input",className:"peer absolute inset-none opacity-0",type:"range",min:"0",max:"5",step:E?.5:1,disabled:j,readOnly:E,value:me(Q??0),onChange:_=>X&&function(w){$.current!==Number(w.target.value)&&Number(w.target.value)!==0&&($.current=Number(w.target.value),at(Number(w.target.value)))}(_),onBlur:function(){P.current?.removeAttribute("data-clicked")}}),l.createElement("div",{className:nt.cx(m==="lg"?"gap-x-md":"gap-x-sm","flex","peer-focus-visible:u-ring peer-[[data-part=input][data-clicked]]:shadow-none")},Array.from({length:5}).map((_,w)=>l.createElement(Ge,{disabled:j,readOnly:E,size:m,onClick:()=>X&&function(O){P.current&&(at(O+1),$.current=O+1,P.current.focus(),P.current.setAttribute("data-clicked",""))}(w),onMouseEnter:O=>X&&function({currentTarget:R}){const ot=A.current.findIndex(x=>x===R),[i,Y]=(S=A.current,y=ot+1,[S.slice(0,y),S.slice(y)]);var S,y;i.forEach(x=>x.setAttribute("data-hovered","")),Y.forEach(x=>x.removeAttribute("data-hovered"))}(O),ref:Ct,key:w,value:Je({index:w,value:Q})}))))});exports.Rating=Ke;
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),nt=require("class-variance-authority"),_e=require("@spark-ui/icon");var Ct=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qe(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var qt={exports:{}};(function(i,v){var g="__lodash_hash_undefined__",m=9007199254740991,j="[object Arguments]",E="[object Array]",J="[object Boolean]",pt="[object Date]",ht="[object Error]",vt="[object Function]",K="[object Map]",$="[object Number]",A="[object Object]",Q="[object Promise]",at="[object RegExp]",B="[object Set]",X="[object String]",Tt="[object Symbol]",_="[object WeakMap]",w="[object ArrayBuffer]",O="[object DataView]",C=/^\[object .+?Constructor\]$/,it=/^(?:0|[1-9]\d*)$/,o={};o["[object Float32Array]"]=o["[object Float64Array]"]=o["[object Int8Array]"]=o["[object Int16Array]"]=o["[object Int32Array]"]=o["[object Uint8Array]"]=o["[object Uint8ClampedArray]"]=o["[object Uint16Array]"]=o["[object Uint32Array]"]=!0,o[j]=o[E]=o[w]=o[J]=o[O]=o[pt]=o[ht]=o[vt]=o[K]=o[$]=o[A]=o[at]=o[B]=o[X]=o[_]=!1;var Y=typeof Ct=="object"&&Ct&&Ct.Object===Object&&Ct,S=typeof self=="object"&&self&&self.Object===Object&&self,y=Y||S||Function("return this")(),x=v&&!v.nodeType&&v,_t=x&&i&&!i.nodeType&&i,L=_t&&_t.exports===x,ot=L&&Y.process,Dt=function(){try{return ot&&ot.binding&&ot.binding("util")}catch{}}(),Ht=Dt&&Dt.isTypedArray;function je(t,e){for(var r=-1,n=t==null?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}function we(t){var e=-1,r=Array(t.size);return t.forEach(function(n,s){r[++e]=[s,n]}),r}function Oe(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Wt,Gt,Jt,xe=Array.prototype,ze=Function.prototype,yt=Object.prototype,It=y["__core-js_shared__"],Kt=ze.toString,N=yt.hasOwnProperty,Qt=(Wt=/[^.]+$/.exec(It&&It.keys&&It.keys.IE_PROTO||""))?"Symbol(src)_1."+Wt:"",Xt=yt.toString,Ae=RegExp("^"+Kt.call(N).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Yt=L?y.Buffer:void 0,bt=y.Symbol,te=y.Uint8Array,ee=yt.propertyIsEnumerable,ke=xe.splice,q=bt?bt.toStringTag:void 0,re=Object.getOwnPropertySymbols,Ee=Yt?Yt.isBuffer:void 0,Se=(Gt=Object.keys,Jt=Object,function(t){return Gt(Jt(t))}),Ft=tt(y,"DataView"),ct=tt(y,"Map"),Pt=tt(y,"Promise"),$t=tt(y,"Set"),Bt=tt(y,"WeakMap"),ut=tt(Object,"create"),Ne=W(Ft),Me=W(ct),Ce=W(Pt),Te=W($t),Ie=W(Bt),ne=bt?bt.prototype:void 0,Lt=ne?ne.valueOf:void 0;function D(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function T(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function H(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function gt(t){var e=-1,r=t==null?0:t.length;for(this.__data__=new H;++e<r;)this.add(t[e])}function R(t){var e=this.__data__=new T(t);this.size=e.size}function Fe(t,e){var r=wt(t),n=!r&&Re(t),s=!r&&!n&&Rt(t),a=!r&&!n&&!s&&de(t),l=r||n||s||a,f=l?function(p,M){for(var I=-1,b=Array(p);++I<p;)b[I]=M(I);return b}(t.length,String):[],k=f.length;for(var d in t)!e&&!N.call(t,d)||l&&(d=="length"||s&&(d=="offset"||d=="parent")||a&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||Le(d,k))||f.push(d);return f}function mt(t,e){for(var r=t.length;r--;)if(ue(t[r][0],e))return r;return-1}function st(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":q&&q in Object(t)?function(e){var r=N.call(e,q),n=e[q];try{e[q]=void 0;var s=!0}catch{}var a=Xt.call(e);return s&&(r?e[q]=n:delete e[q]),a}(t):function(e){return Xt.call(e)}(t)}function ae(t){return lt(t)&&st(t)==j}function ie(t,e,r,n,s){return t===e||(t==null||e==null||!lt(t)&&!lt(e)?t!=t&&e!=e:function(a,l,f,k,d,p){var M=wt(a),I=wt(l),b=M?E:U(a),F=I?E:U(l),et=(b=b==j?A:b)==A,Ot=(F=F==j?A:F)==A,rt=b==F;if(rt&&Rt(a)){if(!Rt(l))return!1;M=!0,et=!1}if(rt&&!et)return p||(p=new R),M||de(a)?oe(a,l,f,k,d,p):function(u,c,xt,V,Ut,z,P){switch(xt){case O:if(u.byteLength!=c.byteLength||u.byteOffset!=c.byteOffset)return!1;u=u.buffer,c=c.buffer;case w:return!(u.byteLength!=c.byteLength||!z(new te(u),new te(c)));case J:case pt:case $:return ue(+u,+c);case ht:return u.name==c.name&&u.message==c.message;case at:case X:return u==c+"";case K:var Z=we;case B:var dt=1&V;if(Z||(Z=Oe),u.size!=c.size&&!dt)return!1;var zt=P.get(u);if(zt)return zt==c;V|=2,P.set(u,c);var Vt=oe(Z(u),Z(c),V,Ut,z,P);return P.delete(u),Vt;case Tt:if(Lt)return Lt.call(u)==Lt.call(c)}return!1}(a,l,b,f,k,d,p);if(!(1&f)){var ft=et&&N.call(a,"__wrapped__"),pe=Ot&&N.call(l,"__wrapped__");if(ft||pe){var Ve=ft?a.value():a,Ze=pe?l.value():l;return p||(p=new R),d(Ve,Ze,f,k,p)}}return rt?(p||(p=new R),function(u,c,xt,V,Ut,z){var P=1&xt,Z=ce(u),dt=Z.length,zt=ce(c),Vt=zt.length;if(dt!=Vt&&!P)return!1;for(var At=dt;At--;){var G=Z[At];if(!(P?G in c:N.call(c,G)))return!1}var he=z.get(u);if(he&&z.get(c))return he==c;var kt=!0;z.set(u,c),z.set(c,u);for(var Zt=P;++At<dt;){var Et=u[G=Z[At]],St=c[G];if(V)var ve=P?V(St,Et,G,c,u,z):V(Et,St,G,u,c,z);if(!(ve===void 0?Et===St||Ut(Et,St,xt,V,z):ve)){kt=!1;break}Zt||(Zt=G=="constructor")}if(kt&&!Zt){var Nt=u.constructor,Mt=c.constructor;Nt==Mt||!("constructor"in u)||!("constructor"in c)||typeof Nt=="function"&&Nt instanceof Nt&&typeof Mt=="function"&&Mt instanceof Mt||(kt=!1)}return z.delete(u),z.delete(c),kt}(a,l,f,k,d,p)):!1}(t,e,r,n,ie,s))}function Pe(t){return!(!fe(t)||function(e){return!!Qt&&Qt in e}(t))&&(se(t)?Ae:C).test(W(t))}function $e(t){if(r=(e=t)&&e.constructor,n=typeof r=="function"&&r.prototype||yt,e!==n)return Se(t);var e,r,n,s=[];for(var a in Object(t))N.call(t,a)&&a!="constructor"&&s.push(a);return s}function oe(t,e,r,n,s,a){var l=1&r,f=t.length,k=e.length;if(f!=k&&!(l&&k>f))return!1;var d=a.get(t);if(d&&a.get(e))return d==e;var p=-1,M=!0,I=2&r?new gt:void 0;for(a.set(t,e),a.set(e,t);++p<f;){var b=t[p],F=e[p];if(n)var et=l?n(F,b,p,e,t,a):n(b,F,p,t,e,a);if(et!==void 0){if(et)continue;M=!1;break}if(I){if(!je(e,function(Ot,rt){if(ft=rt,!I.has(ft)&&(b===Ot||s(b,Ot,r,n,a)))return I.push(rt);var ft})){M=!1;break}}else if(b!==F&&!s(b,F,r,n,a)){M=!1;break}}return a.delete(t),a.delete(e),M}function ce(t){return function(e,r,n){var s=r(e);return wt(e)?s:function(a,l){for(var f=-1,k=l.length,d=a.length;++f<k;)a[d+f]=l[f];return a}(s,n(e))}(t,Ue,Be)}function jt(t,e){var r,n,s=t.__data__;return((n=typeof(r=e))=="string"||n=="number"||n=="symbol"||n=="boolean"?r!=="__proto__":r===null)?s[typeof e=="string"?"string":"hash"]:s.map}function tt(t,e){var r=function(n,s){return n?.[s]}(t,e);return Pe(r)?r:void 0}D.prototype.clear=function(){this.__data__=ut?ut(null):{},this.size=0},D.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},D.prototype.get=function(t){var e=this.__data__;if(ut){var r=e[t];return r===g?void 0:r}return N.call(e,t)?e[t]:void 0},D.prototype.has=function(t){var e=this.__data__;return ut?e[t]!==void 0:N.call(e,t)},D.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ut&&e===void 0?g:e,this},T.prototype.clear=function(){this.__data__=[],this.size=0},T.prototype.delete=function(t){var e=this.__data__,r=mt(e,t);return!(r<0)&&(r==e.length-1?e.pop():ke.call(e,r,1),--this.size,!0)},T.prototype.get=function(t){var e=this.__data__,r=mt(e,t);return r<0?void 0:e[r][1]},T.prototype.has=function(t){return mt(this.__data__,t)>-1},T.prototype.set=function(t,e){var r=this.__data__,n=mt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},H.prototype.clear=function(){this.size=0,this.__data__={hash:new D,map:new(ct||T),string:new D}},H.prototype.delete=function(t){var e=jt(this,t).delete(t);return this.size-=e?1:0,e},H.prototype.get=function(t){return jt(this,t).get(t)},H.prototype.has=function(t){return jt(this,t).has(t)},H.prototype.set=function(t,e){var r=jt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},gt.prototype.add=gt.prototype.push=function(t){return this.__data__.set(t,g),this},gt.prototype.has=function(t){return this.__data__.has(t)},R.prototype.clear=function(){this.__data__=new T,this.size=0},R.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},R.prototype.get=function(t){return this.__data__.get(t)},R.prototype.has=function(t){return this.__data__.has(t)},R.prototype.set=function(t,e){var r=this.__data__;if(r instanceof T){var n=r.__data__;if(!ct||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new H(n)}return r.set(t,e),this.size=r.size,this};var Be=re?function(t){return t==null?[]:(t=Object(t),function(e,r){for(var n=-1,s=e==null?0:e.length,a=0,l=[];++n<s;){var f=e[n];r(f,n,e)&&(l[a++]=f)}return l}(re(t),function(e){return ee.call(t,e)}))}:function(){return[]},U=st;function Le(t,e){return!!(e=e??m)&&(typeof t=="number"||it.test(t))&&t>-1&&t%1==0&&t<e}function W(t){if(t!=null){try{return Kt.call(t)}catch{}try{return t+""}catch{}}return""}function ue(t,e){return t===e||t!=t&&e!=e}(Ft&&U(new Ft(new ArrayBuffer(1)))!=O||ct&&U(new ct)!=K||Pt&&U(Pt.resolve())!=Q||$t&&U(new $t)!=B||Bt&&U(new Bt)!=_)&&(U=function(t){var e=st(t),r=e==A?t.constructor:void 0,n=r?W(r):"";if(n)switch(n){case Ne:return O;case Me:return K;case Ce:return Q;case Te:return B;case Ie:return _}return e});var Re=ae(function(){return arguments}())?ae:function(t){return lt(t)&&N.call(t,"callee")&&!ee.call(t,"callee")},wt=Array.isArray,Rt=Ee||function(){return!1};function se(t){if(!fe(t))return!1;var e=st(t);return e==vt||e=="[object GeneratorFunction]"||e=="[object AsyncFunction]"||e=="[object Proxy]"}function le(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=m}function fe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function lt(t){return t!=null&&typeof t=="object"}var de=Ht?function(t){return function(e){return t(e)}}(Ht):function(t){return lt(t)&&le(t.length)&&!!o[st(t)]};function Ue(t){return(e=t)!=null&&le(e.length)&&!se(e)?Fe(t):$e(t);var e}i.exports=function(t,e){return ie(t,e)}})(qt,qt.exports);const De=qe(qt.exports),be=({title:i,fill:v="currentColor",stroke:g="none",ref:m,...j})=>h.createElement("svg",{ref:m,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"StarFill",...i&&{"data-title":i},fill:v,stroke:g,...j,dangerouslySetInnerHTML:{__html:(i===void 0?"":`<title>${i}</title>`)+'<path d="m11.04,2.25c-.25.17-.5.42-.67.75l-2.08,4.58-4.74.67c-.33,0-.58.17-.91.33-.25.25-.5.5-.58.83-.08.42-.08.75,0,1.08.08.33.25.67.5.92l3.49,3.49-.83,4.99c-.08.33,0,.67.08,1,.08.33.33.58.58.75.25.17.58.33.91.33s.67-.08.91-.17l4.32-2.33,4.32,2.33c.25.17.58.25.91.17.33,0,.67-.17.91-.33.25-.17.5-.5.58-.75.08-.33.17-.67.08-1l-.83-4.99,3.41-3.58c.25-.25.42-.5.5-.83.08-.33.08-.67,0-1-.08-.33-.25-.58-.5-.83-.25-.25-.58-.33-.83-.42l-4.74-.75-2.16-4.49c-.17-.33-.33-.58-.67-.75-.25-.17-.5-.25-.75-.25h-.33c-.42.08-.67.17-.91.25Z"/>'}});be.displayName="StarFill";const ge=({title:i,fill:v="currentColor",stroke:g="none",ref:m,...j})=>h.createElement("svg",{ref:m,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"StarOutline",...i&&{"data-title":i},fill:v,stroke:g,...j,dangerouslySetInnerHTML:{__html:(i===void 0?"":`<title>${i}</title>`)+'<path fill-rule="evenodd" d="m12.02,4.31l-2.01,4.22c-.12.27-.3.5-.53.68-.23.18-.5.29-.79.32l-4.47.69,3.24,3.24c.21.2.36.45.45.73.09.28.11.58.06.87h0s-.78,4.73-.78,4.73l4.03-2.21s.02,0,.03-.01c.25-.13.52-.19.79-.19s.55.07.79.19c0,0,.02,0,.03.01l4.02,2.21-.78-4.66h0c-.05-.29-.03-.59.06-.87.09-.28.24-.52.44-.72l3.21-3.31-4.45-.68c-.28-.04-.56-.15-.79-.32-.23-.18-.41-.41-.53-.68l-2.01-4.22Zm4.91,15.92h0s0,0,0,0ZM11.09,2.28c.28-.18.6-.28.93-.28s.65.1.93.28c.27.18.49.44.63.74l2.16,4.53,4.77.73c.32.05.62.18.87.4.25.22.44.5.54.83.1.32.11.67.03,1-.08.32-.25.62-.48.85l-3.44,3.55.83,4.98c.06.33.02.68-.1.99-.12.31-.33.58-.59.78s-.58.32-.9.34c-.32.02-.65-.05-.94-.21h0s-4.3-2.36-4.3-2.36l-4.3,2.36h0c-.29.16-.61.23-.94.21-.32-.02-.64-.14-.9-.34s-.47-.47-.59-.78c-.12-.31-.16-.65-.1-.99h0s.83-5.04.83-5.04l-3.48-3.49c-.24-.24-.41-.54-.49-.88-.08-.34-.06-.69.05-1.02.11-.33.31-.61.58-.82.25-.2.56-.33.88-.36l4.75-.73,2.16-4.53c.14-.3.36-.56.63-.74Z"/>'}});ge.displayName="StarOutline";const He=nt.cx("peer-hover:[&_>_div]:!w-none"),We=nt.cva(["peer","after:inset-none","group","relative","after:block after:absolute"],{variants:{disabled:{true:"opacity-dim-3",false:""},readOnly:{true:"",false:""},gap:{sm:["after:w-[calc(100%_+_theme(spacing.sm))]","last-of-type:after:content-none"],md:["after:w-[calc(100%_+_theme(spacing.md))]","last-of-type:after:content-none"]}},compoundVariants:[{readOnly:!1,disabled:!1,className:nt.cx(He,"cursor-pointer")}],defaultVariants:{disabled:!1,readOnly:!1,gap:"sm"}}),ye=nt.cva("",{variants:{size:{sm:"text-caption-link",md:"text-body-1",lg:"text-display-1"},design:{filled:["text-main-variant","group-[[data-part=star][data-hovered]]:text-main-variant-hovered"],outlined:["text-on-surface/dim-3"]}}}),Ge=({value:i,size:v,disabled:g,readOnly:m,onClick:j,onMouseEnter:E,ref:J})=>h.createElement("div",{ref:J,onMouseEnter:E,className:We({gap:v==="lg"?"md":"sm",disabled:g,readOnly:m}),"data-part":"star",onClick:j},h.createElement("div",{className:nt.cx("absolute z-raised overflow-hidden","group-[[data-part=star][data-hovered]]:overflow-visible"),style:{width:100*i+"%"}},h.createElement(_e.Icon,{className:ye({size:v,design:"filled"})},h.createElement(be,null))),h.createElement(_e.Icon,{className:ye({size:v,design:"outlined"})},h.createElement(ge,null)));function me(i){return .5*Math.round(i/.5)}function Je({value:i,index:v}){if(i===void 0)return 0;const g=v+1,m=me(i);return Math.ceil(m)<g?0:m>=g?1:.5}exports.Rating=({defaultValue:i,value:v,onValueChange:g,size:m="md",disabled:j,readOnly:E,name:J,id:pt,"aria-label":ht,ref:vt,...K})=>{const $=h.useRef(null),A=h.useRef([]),[Q,at]=function(_,w,O){const C=_!==void 0,{current:it}=h.useRef(C?_:w),[o,Y]=h.useState(w),S=C?_:o,y=h.useCallback((x,_t=(L,ot)=>!De(L,ot))=>{const L=typeof x!="function"?x:x(S);_t(S,L)&&!C&&Y(L),O&&O(L)},[C,S,O]);return[S,y,C,it]}(v,i,g),B=h.useRef(Q),X=!(j||E),Tt=h.useCallback(_=>{_&&A.current.push(_)},[]);return h.createElement("div",{className:"relative inline-flex",ref:vt,"data-spark-component":"rating",...K,onMouseLeave:function(){A.current.forEach(_=>_.removeAttribute("data-hovered"))}},h.createElement("input",{name:J,id:pt,"aria-label":ht,ref:$,"data-part":"input",className:"peer absolute inset-none opacity-0",type:"range",min:"0",max:"5",step:E?.5:1,disabled:j,readOnly:E,value:me(Q??0),onChange:_=>X&&function(w){B.current!==Number(w.target.value)&&Number(w.target.value)!==0&&(B.current=Number(w.target.value),at(Number(w.target.value)))}(_),onBlur:function(){$.current?.removeAttribute("data-clicked")}}),h.createElement("div",{className:nt.cx(m==="lg"?"gap-x-md":"gap-x-sm","flex","peer-focus-visible:u-ring peer-[[data-part=input][data-clicked]]:shadow-none")},Array.from({length:5}).map((_,w)=>h.createElement(Ge,{disabled:j,readOnly:E,size:m,onClick:()=>X&&function(O){$.current&&(at(O+1),B.current=O+1,$.current.focus(),$.current.setAttribute("data-clicked",""))}(w),onMouseEnter:O=>X&&function({currentTarget:C}){const it=A.current.findIndex(x=>x===C),[o,Y]=(S=A.current,y=it+1,[S.slice(0,y),S.slice(y)]);var S,y;o.forEach(x=>x.setAttribute("data-hovered","")),Y.forEach(x=>x.removeAttribute("data-hovered"))}(O),ref:Tt,key:w,value:Je({index:w,value:Q})}))))};

@@ -280,10 +280,19 @@ {

},
"readOnly": {
"ref": {
"defaultValue": null,
"description": "",
"name": "readOnly",
"declarations": [],
"name": "ref",
"parent": {
"fileName": "rating/src/RatingStar.tsx",
"name": "RatingStarProps"
},
"declarations": [
{
"fileName": "rating/src/RatingStar.tsx",
"name": "RatingStarProps"
}
],
"required": false,
"type": {
"name": "boolean"
"name": "Ref<HTMLDivElement>"
}

@@ -301,2 +310,12 @@ },

},
"readOnly": {
"defaultValue": null,
"description": "",
"name": "readOnly",
"declarations": [],
"required": false,
"type": {
"name": "boolean"
}
},
"size": {

@@ -303,0 +322,0 @@ "defaultValue": null,

@@ -1,4 +0,4 @@

import { type ComponentPropsWithoutRef, type PropsWithChildren } from 'react';
import { type ComponentPropsWithRef, type PropsWithChildren } from 'react';
import { type RatingStarProps } from './RatingStar';
export interface RatingProps extends PropsWithChildren<ComponentPropsWithoutRef<'div'>> {
export interface RatingProps extends PropsWithChildren<ComponentPropsWithRef<'div'>> {
/**

@@ -52,2 +52,2 @@ * Use the `defaultValue` prop to set the default value of the input, on a from 0 to 5.

}
export declare const Rating: import("react").ForwardRefExoticComponent<RatingProps & import("react").RefAttributes<HTMLDivElement>>;
export declare const Rating: ({ defaultValue, value: propValue, onValueChange, size, disabled, readOnly, name, id, "aria-label": ariaLabel, ref, ...rest }: RatingProps) => import("react").JSX.Element;

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

import { type MouseEvent } from 'react';
import { type MouseEvent, Ref } from 'react';
import { type RatingStarIconStylesProps, type RatingStarstylesProps } from './RatingStar.styles';

@@ -8,3 +8,4 @@ import type { StarValue } from './types';

onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
ref?: Ref<HTMLDivElement>;
}
export declare const RatingStar: import("react").ForwardRefExoticComponent<RatingStarProps & import("react").RefAttributes<HTMLDivElement>>;
export declare const RatingStar: ({ value, size, disabled, readOnly, onClick, onMouseEnter, ref: forwardedRef, }: RatingStarProps) => import("react").JSX.Element;
{
"name": "@spark-ui/rating",
"version": "7.3.7",
"version": "8.0.0",
"description": "Ratings let users see and/or set a star rating for a product or other item",

@@ -26,4 +26,4 @@ "publishConfig": {

"devDependencies": {
"@spark-ui/icon": "^7.3.7",
"@spark-ui/icons": "^7.3.7"
"@spark-ui/icon": "^8.0.0",
"@spark-ui/icons": "^8.0.0"
},

@@ -49,3 +49,3 @@ "peerDependencies": {

"license": "MIT",
"gitHead": "ca2b7a1f2a4a921fd4c6ad8521c2dfd90471f7d6"
"gitHead": "309903aa55f44ebd43d2a1fe43691f110a5036ea"
}

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