import{r as t,d as a,B as r,h as i,e as s}from"./p-03169580.js";const n=".star-rating{display:flex;flex-direction:row-reverse;justify-content:space-around;text-align:center;width:var(\n    --star-rating-width,\n    calc(\n      (var(--star-rating-size, 25px) * var(--star-rating-max, 5)) +\n        var(--star-rating-spacing, -10px)\n    )\n  )}.star-rating input{display:none}.star-rating>label{color:var(--star-rating-default, #fff);font-size:var(--star-rating-size, 25px);cursor:pointer}.star-rating .star-active{color:var(--star-rating-active, var(--ion-color-warning-shade, #f90))}.star-rating:not(.is-disabled) label:hover,.star-rating:not(.is-disabled) label:hover~label{color:var(--star-rating-hover, var(--ion-color-warning-tint, #fc0))}";let e=class{constructor(r){t(this,r);this.fireenjinStarRating=a(this,"fireenjinStarRating",7);this.disabled=false;this.name="rating";this.maxRating=5}onInput(t){console.log(t);if(this.disabled){return false}this.currentRating=parseFloat(t.target.value);this.fireenjinStarRating.emit({event:t,name:this.name,value:this.currentRating})}async setCurrentRating(t){this.currentRating=parseFloat(t)}onValueChange(){this.currentRating=parseFloat(this.value)}componentDidLoad(){if(!(r===null||r===void 0?void 0:r.isBrowser))return;this.currentRating=parseFloat(this.value?this.value:"0");this.starRatingEl.style.setProperty("--star-rating-max",`${this.maxRating}`)}render(){return i("div",{class:this.disabled?"star-rating is-disabled":"star-rating"},[...Array(this.maxRating)].map(((t,a)=>[i("label",{class:this.currentRating>=this.maxRating-a-.5?"star-active":null},i("input",{type:"radio",name:this.name,value:this.maxRating-a,onInput:t=>this.onInput(t)}),"★")])))}get starRatingEl(){return s(this)}static get watchers(){return{value:["onValueChange"]}}};e.style=n;export{e as fireenjin_star_rating};
//# sourceMappingURL=p-8b1f41a5.entry.js.map