Socket
Socket
Sign inDemoInstall

@spark-ui/rating

Package Overview
Dependencies
140
Maintainers
7
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.2.0

dist/RatingStar.d.ts

11

CHANGELOG.md

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

# [0.2.0](https://github.com/adevinta/spark/compare/@spark-ui/rating@0.1.1...@spark-ui/rating@0.2.0) (2023-11-03)
### Features
- **rating:** add shared types ([d96c445](https://github.com/adevinta/spark/commit/d96c445de50571c670c5467cf3349c991fcb27c2))
- **rating:** add utils ([40a900f](https://github.com/adevinta/spark/commit/40a900f97967c4cadc3b67e319ba34e82164edae))
- **rating:** create RatingStar component ([890d09d](https://github.com/adevinta/spark/commit/890d09dabff9727ccb86f0ef2e4652eb5922eaf9))
- **rating:** fully implement Rating component ([a3579ad](https://github.com/adevinta/spark/commit/a3579adffbfd0e0bcb7477af63fd249fea0344c6))
- **rating:** small updates following PR feedbacks ([f72b774](https://github.com/adevinta/spark/commit/f72b774edf0cea9d6ea785bdcb25d1f4648cbfb4))
- **rating:** use useCombinedState to handle controlled/uncontrolled mode ([c043a63](https://github.com/adevinta/spark/commit/c043a6323a427be1ba29c6ae7042711277e3a688))
## [0.1.1](https://github.com/adevinta/spark/compare/@spark-ui/rating@0.1.0...@spark-ui/rating@0.1.1) (2023-10-30)

@@ -8,0 +19,0 @@

2

dist/index.d.ts

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

export { Rating } from './Rating';
export { Rating, type RatingProps } from './Rating';

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

"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");exports.Rating=()=>e.createElement(e.Fragment,null,"rating");
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),at=require("class-variance-authority"),we=require("@spark-ui/icon");var Rt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Je(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Ht={exports:{}};(function(o,_){var g="__lodash_hash_undefined__",v=1,y=2,F=9007199254740991,P="[object Arguments]",ot="[object Array]",pt="[object AsyncFunction]",vt="[object Boolean]",$="[object Date]",q="[object Error]",X="[object Function]",_t="[object GeneratorFunction]",B="[object Map]",Y="[object Number]",Ct="[object Null]",M="[object Object]",m="[object Promise]",w="[object Proxy]",A="[object RegExp]",O="[object Set]",tt="[object String]",it="[object Symbol]",ut="[object Undefined]",z="[object WeakMap]",L="[object ArrayBuffer]",j="[object DataView]",Tt=/^\[object .+?Constructor\]$/,H=/^(?:0|[1-9]\d*)$/,u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u[P]=u[ot]=u[L]=u[vt]=u[j]=u[$]=u[q]=u[X]=u[B]=u[Y]=u[M]=u[A]=u[O]=u[tt]=u[z]=!1;var Wt=typeof Rt=="object"&&Rt&&Rt.Object===Object&&Rt,Ae=typeof self=="object"&&self&&self.Object===Object&&self,N=Wt||Ae||Function("return this")(),Gt=_&&!_.nodeType&&_,Kt=Gt&&o&&!o.nodeType&&o,Jt=Kt&&Kt.exports===Gt,It=Jt&&Wt.process,Qt=function(){try{return It&&It.binding&&It.binding("util")}catch{}}(),Xt=Qt&&Qt.isTypedArray;function ke(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 Ee(t){var e=-1,r=Array(t.size);return t.forEach(function(n,l){r[++e]=[l,n]}),r}function Se(t){var e=-1,r=Array(t.size);return t.forEach(function(n){r[++e]=n}),r}var Yt,te,ee,Me=Array.prototype,Ne=Function.prototype,yt=Object.prototype,Ft=N["__core-js_shared__"],re=Ne.toString,E=yt.hasOwnProperty,ne=(Yt=/[^.]+$/.exec(Ft&&Ft.keys&&Ft.keys.IE_PROTO||""))?"Symbol(src)_1."+Yt:"",ae=yt.toString,Re=RegExp("^"+re.call(E).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oe=Jt?N.Buffer:void 0,bt=N.Symbol,ie=N.Uint8Array,ue=yt.propertyIsEnumerable,Ce=Me.splice,W=bt?bt.toStringTag:void 0,ce=Object.getOwnPropertySymbols,Te=oe?oe.isBuffer:void 0,Ie=(te=Object.keys,ee=Object,function(t){return te(ee(t))}),Pt=et(N,"DataView"),ct=et(N,"Map"),$t=et(N,"Promise"),Bt=et(N,"Set"),Lt=et(N,"WeakMap"),lt=et(Object,"create"),Fe=J(Pt),Pe=J(ct),$e=J($t),Be=J(Bt),Le=J(Lt),le=bt?bt.prototype:void 0,Ut=le?le.valueOf:void 0;function G(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 R(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 K(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 K;++e<r;)this.add(t[e])}function U(t){var e=this.__data__=new R(t);this.size=e.size}function Ue(t,e){var r=wt(t),n=!r&&He(t),l=!r&&!n&&Vt(t),a=!r&&!n&&!l&&be(t),f=r||n||l||a,d=f?function(p,S){for(var C=-1,b=Array(p);++C<p;)b[C]=S(C);return b}(t.length,String):[],k=d.length;for(var h in t)!e&&!E.call(t,h)||f&&(h=="length"||l&&(h=="offset"||h=="parent")||a&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||qe(h,k))||d.push(h);return d}function mt(t,e){for(var r=t.length;r--;)if(pe(t[r][0],e))return r;return-1}function st(t){return t==null?t===void 0?ut:Ct:W&&W in Object(t)?function(e){var r=E.call(e,W),n=e[W];try{e[W]=void 0;var l=!0}catch{}var a=ae.call(e);return l&&(r?e[W]=n:delete e[W]),a}(t):function(e){return ae.call(e)}(t)}function se(t){return ft(t)&&st(t)==P}function fe(t,e,r,n,l){return t===e||(t==null||e==null||!ft(t)&&!ft(e)?t!=t&&e!=e:function(a,f,d,k,h,p){var S=wt(a),C=wt(f),b=S?ot:V(a),T=C?ot:V(f),rt=(b=b==P?M:b)==M,Ot=(T=T==P?M:T)==M,nt=b==T;if(nt&&Vt(a)){if(!Vt(f))return!1;S=!0,rt=!1}if(nt&&!rt)return p||(p=new U),S||be(a)?de(a,f,d,k,h,p):function(c,i,zt,D,Dt,x,I){switch(zt){case j:if(c.byteLength!=i.byteLength||c.byteOffset!=i.byteOffset)return!1;c=c.buffer,i=i.buffer;case L:return!(c.byteLength!=i.byteLength||!x(new ie(c),new ie(i)));case vt:case $:case Y:return pe(+c,+i);case q:return c.name==i.name&&c.message==i.message;case A:case tt:return c==i+"";case B:var Z=Ee;case O:var ht=D&v;if(Z||(Z=Se),c.size!=i.size&&!ht)return!1;var xt=I.get(c);if(xt)return xt==i;D|=y,I.set(c,i);var Zt=de(Z(c),Z(i),D,Dt,x,I);return I.delete(c),Zt;case it:if(Ut)return Ut.call(c)==Ut.call(i)}return!1}(a,f,b,d,k,h,p);if(!(d&v)){var dt=rt&&E.call(a,"__wrapped__"),ge=Ot&&E.call(f,"__wrapped__");if(dt||ge){var Ge=dt?a.value():a,Ke=ge?f.value():f;return p||(p=new U),h(Ge,Ke,d,k,p)}}return nt?(p||(p=new U),function(c,i,zt,D,Dt,x){var I=zt&v,Z=he(c),ht=Z.length,xt=he(i),Zt=xt.length;if(ht!=Zt&&!I)return!1;for(var At=ht;At--;){var Q=Z[At];if(!(I?Q in i:E.call(i,Q)))return!1}var me=x.get(c);if(me&&x.get(i))return me==i;var kt=!0;x.set(c,i),x.set(i,c);for(var qt=I;++At<ht;){var Et=c[Q=Z[At]],St=i[Q];if(D)var je=I?D(St,Et,Q,i,c,x):D(Et,St,Q,c,i,x);if(!(je===void 0?Et===St||Dt(Et,St,zt,D,x):je)){kt=!1;break}qt||(qt=Q=="constructor")}if(kt&&!qt){var Mt=c.constructor,Nt=i.constructor;Mt==Nt||!("constructor"in c)||!("constructor"in i)||typeof Mt=="function"&&Mt instanceof Mt&&typeof Nt=="function"&&Nt instanceof Nt||(kt=!1)}return x.delete(c),x.delete(i),kt}(a,f,d,k,h,p)):!1}(t,e,r,n,fe,l))}function Ve(t){return!(!ye(t)||function(e){return!!ne&&ne in e}(t))&&(ve(t)?Re:Tt).test(J(t))}function De(t){if(r=(e=t)&&e.constructor,n=typeof r=="function"&&r.prototype||yt,e!==n)return Ie(t);var e,r,n,l=[];for(var a in Object(t))E.call(t,a)&&a!="constructor"&&l.push(a);return l}function de(t,e,r,n,l,a){var f=r&v,d=t.length,k=e.length;if(d!=k&&!(f&&k>d))return!1;var h=a.get(t);if(h&&a.get(e))return h==e;var p=-1,S=!0,C=r&y?new gt:void 0;for(a.set(t,e),a.set(e,t);++p<d;){var b=t[p],T=e[p];if(n)var rt=f?n(T,b,p,e,t,a):n(b,T,p,t,e,a);if(rt!==void 0){if(rt)continue;S=!1;break}if(C){if(!ke(e,function(Ot,nt){if(dt=nt,!C.has(dt)&&(b===Ot||l(b,Ot,r,n,a)))return C.push(nt);var dt})){S=!1;break}}else if(b!==T&&!l(b,T,r,n,a)){S=!1;break}}return a.delete(t),a.delete(e),S}function he(t){return function(e,r,n){var l=r(e);return wt(e)?l:function(a,f){for(var d=-1,k=f.length,h=a.length;++d<k;)a[h+d]=f[d];return a}(l,n(e))}(t,We,Ze)}function jt(t,e){var r,n,l=t.__data__;return((n=typeof(r=e))=="string"||n=="number"||n=="symbol"||n=="boolean"?r!=="__proto__":r===null)?l[typeof e=="string"?"string":"hash"]:l.map}function et(t,e){var r=function(n,l){return n?.[l]}(t,e);return Ve(r)?r:void 0}G.prototype.clear=function(){this.__data__=lt?lt(null):{},this.size=0},G.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},G.prototype.get=function(t){var e=this.__data__;if(lt){var r=e[t];return r===g?void 0:r}return E.call(e,t)?e[t]:void 0},G.prototype.has=function(t){var e=this.__data__;return lt?e[t]!==void 0:E.call(e,t)},G.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=lt&&e===void 0?g:e,this},R.prototype.clear=function(){this.__data__=[],this.size=0},R.prototype.delete=function(t){var e=this.__data__,r=mt(e,t);return!(r<0)&&(r==e.length-1?e.pop():Ce.call(e,r,1),--this.size,!0)},R.prototype.get=function(t){var e=this.__data__,r=mt(e,t);return r<0?void 0:e[r][1]},R.prototype.has=function(t){return mt(this.__data__,t)>-1},R.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},K.prototype.clear=function(){this.size=0,this.__data__={hash:new G,map:new(ct||R),string:new G}},K.prototype.delete=function(t){var e=jt(this,t).delete(t);return this.size-=e?1:0,e},K.prototype.get=function(t){return jt(this,t).get(t)},K.prototype.has=function(t){return jt(this,t).has(t)},K.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)},U.prototype.clear=function(){this.__data__=new R,this.size=0},U.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},U.prototype.get=function(t){return this.__data__.get(t)},U.prototype.has=function(t){return this.__data__.has(t)},U.prototype.set=function(t,e){var r=this.__data__;if(r instanceof R){var n=r.__data__;if(!ct||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new K(n)}return r.set(t,e),this.size=r.size,this};var Ze=ce?function(t){return t==null?[]:(t=Object(t),function(e,r){for(var n=-1,l=e==null?0:e.length,a=0,f=[];++n<l;){var d=e[n];r(d,n,e)&&(f[a++]=d)}return f}(ce(t),function(e){return ue.call(t,e)}))}:function(){return[]},V=st;function qe(t,e){return!!(e=e??F)&&(typeof t=="number"||H.test(t))&&t>-1&&t%1==0&&t<e}function J(t){if(t!=null){try{return re.call(t)}catch{}try{return t+""}catch{}}return""}function pe(t,e){return t===e||t!=t&&e!=e}(Pt&&V(new Pt(new ArrayBuffer(1)))!=j||ct&&V(new ct)!=B||$t&&V($t.resolve())!=m||Bt&&V(new Bt)!=O||Lt&&V(new Lt)!=z)&&(V=function(t){var e=st(t),r=e==M?t.constructor:void 0,n=r?J(r):"";if(n)switch(n){case Fe:return j;case Pe:return B;case $e:return m;case Be:return O;case Le:return z}return e});var He=se(function(){return arguments}())?se:function(t){return ft(t)&&E.call(t,"callee")&&!ue.call(t,"callee")},wt=Array.isArray,Vt=Te||function(){return!1};function ve(t){if(!ye(t))return!1;var e=st(t);return e==X||e==_t||e==pt||e==w}function _e(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=F}function ye(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function ft(t){return t!=null&&typeof t=="object"}var be=Xt?function(t){return function(e){return t(e)}}(Xt):function(t){return ft(t)&&_e(t.length)&&!!u[st(t)]};function We(t){return(e=t)!=null&&_e(e.length)&&!ve(e)?Ue(t):De(t);var e}o.exports=function(t,e){return fe(t,e)}})(Ht,Ht.exports);const Qe=Je(Ht.exports),ze=s.forwardRef(({title:o,fill:_="currentColor",stroke:g="none",...v},y)=>s.createElement("svg",{ref:y,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"StarFill",...o&&{"data-title":o},fill:_,stroke:g,...v,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"/>'}}));ze.displayName="StarFill";const xe=s.forwardRef(({title:o,fill:_="currentColor",stroke:g="none",...v},y)=>s.createElement("svg",{ref:y,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-title":"StarOutline",...o&&{"data-title":o},fill:_,stroke:g,...v,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"/>'}}));xe.displayName="StarOutline";const Xe=at.cx("peer-hover:[&_>_div]:!w-none"),Ye=at.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:at.cx(Xe,"cursor-pointer")}],defaultVariants:{disabled:!1,readOnly:!1,gap:"sm"}}),Oe=at.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"]}}}),tr=s.forwardRef(({value:o,size:_,disabled:g,readOnly:v,onClick:y,onMouseEnter:F},P)=>s.createElement("div",{ref:P,onMouseEnter:F,className:Ye({gap:_==="lg"?"md":"sm",disabled:g,readOnly:v}),"data-part":"star",onClick:y},s.createElement("div",{className:at.cx("absolute z-raised overflow-hidden","group-[[data-part=star][data-hovered]]:overflow-visible"),style:{width:100*o+"%"}},s.createElement(we.Icon,{className:Oe({size:_,design:"filled"})},s.createElement(ze,null))),s.createElement(we.Icon,{className:Oe({size:_,design:"outlined"})},s.createElement(xe,null))));function er(o){return o===void 0?0:o-Math.floor(o)>.74?Math.ceil(o):Math.floor(o)}function rr({value:o,index:_}){if(o===void 0)return 0;const g=_+1,v=(y=o,.5*Math.round(y/.5));var y;return Math.ceil(v)<g?0:v>=g?1:.5}const nr=s.forwardRef(({defaultValue:o,value:_,onValueChange:g,size:v="md",disabled:y,readOnly:F,name:P,id:ot,...pt},vt)=>{const $=s.useRef(null),q=s.useRef([]),[X,_t]=function(m,w,A){const O=m!==void 0,{current:tt}=s.useRef(O?m:w),[it,ut]=s.useState(w),z=O?m:it,L=s.useCallback((j,Tt=(H,u)=>!Qe(H,u))=>{const H=typeof j!="function"?j:j(z);Tt(z,H)&&!O&&ut(H),A&&A(H)},[O,z,A]);return[z,L,O,tt]}(_,o,g),B=s.useRef(X),Y=!(y||F),Ct=s.useCallback(m=>{m&&q.current.push(m)},[]);function M(){$.current?.removeAttribute("data-clicked")}return s.createElement("div",{className:"relative",ref:vt,"data-spark-component":"rating",...pt,onMouseLeave:function(){q.current.forEach(m=>m.removeAttribute("data-hovered"))}},s.createElement("input",{name:P,id:ot,"aria-label":pt["aria-label"],ref:$,"data-part":"input",className:"peer absolute inset-none opacity-0",type:"range",min:"0",max:"5",step:1,disabled:y,readOnly:F,value:er(X),onChange:m=>Y&&function(w){B.current!==Number(w.target.value)&&(B.current=Number(w.target.value),_t(Number(w.target.value)))}(m),onKeyDown:M,onBlur:M}),s.createElement("div",{className:at.cx(v==="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((m,w)=>s.createElement(tr,{disabled:y,readOnly:F,size:v,onClick:()=>Y&&function(A){$.current&&(_t(A+1),B.current=A+1,$.current.focus(),$.current.setAttribute("data-clicked",""))}(w),onMouseEnter:A=>Y&&function({currentTarget:O}){const tt=q.current.findIndex(j=>j===O),[it,ut]=(z=q.current,L=tt+1,[z.slice(0,L),z.slice(L)]);var z,L;it.forEach(j=>j.setAttribute("data-hovered","")),ut.forEach(j=>j.removeAttribute("data-hovered"))}(A),ref:Ct,key:w,value:rr({index:w,value:X})}))))});exports.Rating=nr;

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

{}
{
"Rating": {
"tags": {},
"description": "",
"displayName": "Rating",
"methods": [],
"props": {
"defaultValue": {
"defaultValue": null,
"description": "Use the `defaultValue` prop to set the default value of the input, on a from 0 to 5.\n\nUse this when you want to use it in an uncontrolled manner",
"name": "defaultValue",
"parent": {
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
},
"declarations": [
{
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
}
],
"required": false,
"type": {
"name": "number"
}
},
"value": {
"defaultValue": null,
"description": "The value is the number of the rating selected, on a scale from 0 to 5.\n\nUse this when you want to use it in a controlled manner,\nin conjunction with the `onValueChange` prop",
"name": "value",
"parent": {
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
},
"declarations": [
{
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
}
],
"required": false,
"type": {
"name": "number"
}
},
"onValueChange": {
"defaultValue": null,
"description": "Event handler called when the value changes.",
"name": "onValueChange",
"parent": {
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
},
"declarations": [
{
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
}
],
"required": false,
"type": {
"name": "(value: number) => void"
}
},
"readOnly": {
"defaultValue": {
"value": "undefined"
},
"description": "Sets the component as interactive or not.",
"name": "readOnly",
"parent": {
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
},
"declarations": [
{
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
}
],
"required": false,
"type": {
"name": "boolean"
}
},
"disabled": {
"defaultValue": {
"value": "false"
},
"description": "When `true`, prevents the user from interacting.",
"name": "disabled",
"parent": {
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
},
"declarations": [
{
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
}
],
"required": false,
"type": {
"name": "boolean"
}
},
"size": {
"defaultValue": {
"value": "md"
},
"description": "Sets the size of the stars.",
"name": "size",
"parent": {
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
},
"declarations": [
{
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
}
],
"required": false,
"type": {
"name": "enum",
"raw": "\"sm\" | \"md\" | \"lg\"",
"value": [
{
"value": "\"sm\""
},
{
"value": "\"md\""
},
{
"value": "\"lg\""
}
]
}
},
"name": {
"defaultValue": {
"value": "undefined"
},
"description": "Name of the underlying input.",
"name": "name",
"parent": {
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
},
"declarations": [
{
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
}
],
"required": false,
"type": {
"name": "string"
}
},
"id": {
"defaultValue": {
"value": "undefined"
},
"description": "id of the underlying input.",
"name": "id",
"parent": {
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
},
"declarations": [
{
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
}
],
"required": false,
"type": {
"name": "string"
}
},
"aria-label": {
"defaultValue": {
"value": "undefined"
},
"description": "aria-label of the underlying input.",
"name": "aria-label",
"parent": {
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
},
"declarations": [
{
"fileName": "rating/src/Rating.tsx",
"name": "RatingProps"
}
],
"required": true,
"type": {
"name": "string"
}
}
}
},
"RatingStar": {
"tags": {},
"description": "",
"displayName": "RatingStar",
"methods": [],
"props": {
"value": {
"defaultValue": null,
"description": "",
"name": "value",
"parent": {
"fileName": "rating/src/RatingStar.tsx",
"name": "RatingStarProps"
},
"declarations": [
{
"fileName": "rating/src/RatingStar.tsx",
"name": "RatingStarProps"
}
],
"required": true,
"type": {
"name": "enum",
"raw": "StarValue",
"value": [
{
"value": "0"
},
{
"value": "1"
},
{
"value": "0.5"
}
]
}
},
"onClick": {
"defaultValue": null,
"description": "",
"name": "onClick",
"parent": {
"fileName": "rating/src/RatingStar.tsx",
"name": "RatingStarProps"
},
"declarations": [
{
"fileName": "rating/src/RatingStar.tsx",
"name": "RatingStarProps"
}
],
"required": false,
"type": {
"name": "(event: MouseEvent<HTMLDivElement, MouseEvent>) => void"
}
},
"onMouseEnter": {
"defaultValue": null,
"description": "",
"name": "onMouseEnter",
"parent": {
"fileName": "rating/src/RatingStar.tsx",
"name": "RatingStarProps"
},
"declarations": [
{
"fileName": "rating/src/RatingStar.tsx",
"name": "RatingStarProps"
}
],
"required": false,
"type": {
"name": "(event: MouseEvent<HTMLDivElement, MouseEvent>) => void"
}
},
"disabled": {
"defaultValue": null,
"description": "",
"name": "disabled",
"declarations": [],
"required": false,
"type": {
"name": "boolean"
}
},
"readOnly": {
"defaultValue": null,
"description": "",
"name": "readOnly",
"declarations": [],
"required": false,
"type": {
"name": "boolean"
}
},
"size": {
"defaultValue": null,
"description": "",
"name": "size",
"declarations": [],
"required": false,
"type": {
"name": "enum",
"raw": "\"sm\" | \"md\" | \"lg\"",
"value": [
{
"value": "\"sm\""
},
{
"value": "\"md\""
},
{
"value": "\"lg\""
}
]
}
}
}
},
"getNearestDecimal": {
"tags": {},
"description": "",
"displayName": "getNearestDecimal",
"methods": [],
"props": {
"toString": {
"defaultValue": {},
"description": "Returns a string representation of an object.\n@param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers.",
"name": "toString",
"parent": {
"fileName": "spark/node_modules/typescript/lib/lib.es5.d.ts",
"name": "Number"
},
"declarations": [
{
"fileName": "spark/node_modules/typescript/lib/lib.es5.d.ts",
"name": "Number"
}
],
"required": false,
"type": {
"name": "(radix?: number) => string"
}
},
"toFixed": {
"defaultValue": null,
"description": "Returns a string representing a number in fixed-point notation.\n@param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.",
"name": "toFixed",
"parent": {
"fileName": "spark/node_modules/typescript/lib/lib.es5.d.ts",
"name": "Number"
},
"declarations": [
{
"fileName": "spark/node_modules/typescript/lib/lib.es5.d.ts",
"name": "Number"
}
],
"required": true,
"type": {
"name": "(fractionDigits?: number) => string"
}
},
"toExponential": {
"defaultValue": null,
"description": "Returns a string containing a number represented in exponential notation.\n@param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.",
"name": "toExponential",
"parent": {
"fileName": "spark/node_modules/typescript/lib/lib.es5.d.ts",
"name": "Number"
},
"declarations": [
{
"fileName": "spark/node_modules/typescript/lib/lib.es5.d.ts",
"name": "Number"
}
],
"required": true,
"type": {
"name": "(fractionDigits?: number) => string"
}
},
"toPrecision": {
"defaultValue": null,
"description": "Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits.\n@param precision Number of significant digits. Must be in the range 1 - 21, inclusive.",
"name": "toPrecision",
"parent": {
"fileName": "spark/node_modules/typescript/lib/lib.es5.d.ts",
"name": "Number"
},
"declarations": [
{
"fileName": "spark/node_modules/typescript/lib/lib.es5.d.ts",
"name": "Number"
}
],
"required": true,
"type": {
"name": "(precision?: number) => string"
}
},
"valueOf": {
"defaultValue": {},
"description": "Returns the primitive value of the specified object.",
"name": "valueOf",
"parent": {
"fileName": "spark/node_modules/typescript/lib/lib.es5.d.ts",
"name": "Number"
},
"declarations": [
{
"fileName": "spark/node_modules/typescript/lib/lib.es5.d.ts",
"name": "Number"
}
],
"required": false,
"type": {
"name": "() => number"
}
},
"toLocaleString": {
"defaultValue": {},
"description": "Converts a number to a string by using the current or specified locale.\n@param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n@param options An object that contains one or more properties that specify comparison options.\n@param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.\n@param options An object that contains one or more properties that specify comparison options.",
"name": "toLocaleString",
"parent": {
"fileName": "spark/node_modules/typescript/lib/lib.es5.d.ts",
"name": "Number"
},
"declarations": [
{
"fileName": "spark/node_modules/typescript/lib/lib.es5.d.ts",
"name": "Number"
},
{
"fileName": "spark/node_modules/typescript/lib/lib.es2020.number.d.ts",
"name": "Number"
}
],
"required": false,
"type": {
"name": "{ (locales?: string | string[], options?: NumberFormatOptions): string; (locales?: LocalesArgument, options?: NumberFormatOptions): string; }"
}
}
}
},
"getStarValue": {
"tags": {},
"description": "",
"displayName": "getStarValue",
"methods": [],
"props": {
"value": {
"defaultValue": null,
"description": "",
"name": "value",
"declarations": [
{
"fileName": "rating/src/utils.ts",
"name": "TypeLiteral"
}
],
"required": false,
"type": {
"name": "number"
}
},
"index": {
"defaultValue": null,
"description": "",
"name": "index",
"declarations": [
{
"fileName": "rating/src/utils.ts",
"name": "TypeLiteral"
}
],
"required": true,
"type": {
"name": "number"
}
}
}
}
}

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

export declare const Rating: () => import("react").JSX.Element;
import { type ComponentPropsWithoutRef, type PropsWithChildren } from 'react';
import { type RatingStarProps } from './RatingStar';
export interface RatingProps extends PropsWithChildren<ComponentPropsWithoutRef<'div'>> {
/**
* Use the `defaultValue` prop to set the default value of the input, on a from 0 to 5.
*
* Use this when you want to use it in an uncontrolled manner
*/
defaultValue?: number;
/**
* The value is the number of the rating selected, on a scale from 0 to 5.
*
* Use this when you want to use it in a controlled manner,
* in conjunction with the `onValueChange` prop
*/
value?: number;
/**
* Event handler called when the value changes.
*/
onValueChange?: (value: number) => void;
/**
* Sets the component as interactive or not.
* @default undefined
*/
readOnly?: boolean;
/**
* When `true`, prevents the user from interacting.
* @default false
*/
disabled?: boolean;
/**
* Sets the size of the stars.
* @default 'md'
*/
size?: RatingStarProps['size'];
/**
* Name of the underlying input.
* @default undefined
*/
name?: string;
/**
* id of the underlying input.
* @default undefined
*/
id?: string;
/**
* aria-label of the underlying input.
* @default undefined
*/
'aria-label': string;
}
export declare const Rating: import("react").ForwardRefExoticComponent<RatingProps & import("react").RefAttributes<HTMLDivElement>>;
{
"name": "@spark-ui/rating",
"version": "0.1.1",
"version": "0.2.0",
"description": "Ratings let users see and/or set a star rating for a product or other item",

@@ -48,3 +48,3 @@ "publishConfig": {

"license": "MIT",
"gitHead": "2cc64eba14990d724d1996e5048aecb049b64df5"
"gitHead": "3d261de26a37cdeaafa5b51db961681cb37a15fe"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc