Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

react-custom-ratings

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-custom-ratings - npm Package Compare versions

Comparing version
0.1.1
to
0.1.2
+32
src/components/ProgressBar/progressBar.css
.container {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
gap: 1.2rem;
box-sizing: border-box;
padding: 10px;
}
.inner_container {
width: 100%;
height: 1.2rem;
display: flex;
flex-direction: row;
align-items: center;
gap: 0.8rem;
}
.subtext {
font-size: 14px;
white-space: nowrap;
display: flex;
}
.percent_text {
font-size: 14px;
white-space: nowrap;
display: flex;
width: 35px;
justify-content: flex-end;
}
.filled {
font-size: 3rem;
position: absolute;
top: 0;
left: 0;
white-space: nowrap;
overflow: hidden;
width: 0;
/* overflow: hidden; */
}
span {
font-size: 3rem;
/* overflow: hidden; */
}
.star {
font-size: 3rem;
/* overflow: hidden; */
}
.starRating {
display: flex;
justify-content: center;
}
.starRating .rating {
font-size: 14px;
white-space: nowrap;
margin-left: 1rem;
}
.ratings_container {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
justify-content: center;
background-color: #fff;
}
+1
-0
/// <reference types="react" />
import { ProgressBarProps } from '../../Types/ProgressBar';
import './progressBar.css';
declare function RatingBars(props: ProgressBarProps): JSX.Element;
export default RatingBars;
import React from 'react';
import './filled.css';
import { Data } from '../../../Types/Data';

@@ -3,0 +4,0 @@ interface Props {

/// <reference types="react" />
import './starRating.css';
import { RatingHeaderType } from '../../Types/RatingHeader';
declare function StarRating(props: RatingHeaderType): JSX.Element;
export default StarRating;
/// <reference types="react" />
import './ratings.css';
import { RatingsProps } from '../../Types/Ratings';
declare const Ratings: ({ data, options }: RatingsProps) => JSX.Element;
export default Ratings;
+9
-9

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

.filled-module_filled__7APsd {
.filled {
font-size: 3rem;

@@ -15,3 +15,3 @@ position: absolute;

}
.filled-module_star__DjRcp {
.star {
font-size: 3rem;

@@ -39,7 +39,7 @@ /* overflow: hidden; */

.starRating-module_starRating__8Gp7A {
.starRating {
display: flex;
justify-content: center;
}
.starRating-module_starRating__8Gp7A .starRating-module_rating__WyRjo {
.starRating .rating {
font-size: 14px;

@@ -50,3 +50,3 @@ white-space: nowrap;

.ratings-module_container__3oVdJ {
.ratings_container {
display: flex;

@@ -72,3 +72,3 @@ flex-direction: column;

.progressBar-module_container__cq1Qv {
.container {
width: 100%;

@@ -83,3 +83,3 @@ height: 100%;

.progressBar-module_inner_container__Ig-ty {
.inner_container {
width: 100%;

@@ -93,3 +93,3 @@ height: 1.2rem;

.progressBar-module_subtext__bfp0o {
.subtext {
font-size: 14px;

@@ -100,3 +100,3 @@ white-space: nowrap;

.progressBar-module_percent_text__h5xUT {
.percent_text {
font-size: 14px;

@@ -103,0 +103,0 @@ white-space: nowrap;

@@ -10,4 +10,2 @@ 'use strict';

var classes = {"filled":"filled-module_filled__7APsd","star":"filled-module_star__DjRcp"};
var clsx = function clsx() {

@@ -44,3 +42,3 @@ for (var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++) {

return React.createElement("div", {
className: classes.filled,
className: 'filled',
style: {

@@ -52,3 +50,3 @@ width: width

key: "unfilled-star custom icon " + i,
className: clsx(classes.star, ratingIconClassname),
className: clsx('star', ratingIconClassname),
style: {

@@ -61,3 +59,3 @@ color: filledColor || starColors.filled

var classes$1 = {"unfilled":"Unfilled-module_unfilled__2wGJ3","filled":"Unfilled-module_filled__-I2up"};
var classes = {"unfilled":"Unfilled-module_unfilled__2wGJ3","filled":"Unfilled-module_filled__-I2up"};

@@ -79,3 +77,3 @@ /*eslint-disable*/

return React.createElement("div", {
className: classes$1.unfilled
className: classes.unfilled
}, [].concat(Array(numberOfRating)).map(function (_, i) {

@@ -85,3 +83,3 @@ return React.createElement("span", {

// eslint-disable-next-line no-unneeded-ternary
className: clsx(classes$1.star, ratingIconClassname),
className: clsx(classes.star, ratingIconClassname),
style: {

@@ -101,4 +99,2 @@ // eslint-disable-next-line no-unneeded-ternary

var classes$2 = {"starRating":"starRating-module_starRating__8Gp7A","rating":"starRating-module_rating__WyRjo"};
function StarRating$1(props) {

@@ -142,3 +138,3 @@ var data = props.data,

return React.createElement(React.Fragment, null, show && React.createElement("div", {
className: classes$2.starRating
className: 'starRating'
}, React.createElement(StarRating, {

@@ -153,8 +149,6 @@ data: data,

}), (headerText == null ? void 0 : headerText(totalPercentage)) || React.createElement("p", {
className: clsx(classes$2.rating, className)
className: clsx('rating', className)
}, totalPercentage.toFixed(2), " out of ", numberOfRating)));
}
var classes$3 = {"container":"ratings-module_container__3oVdJ"};
function _extends() {

@@ -178,3 +172,3 @@ _extends = Object.assign || function (target) {

var classes$4 = {"progress_bar":"progress-module_progress_bar__QisS6","filled_bar":"progress-module_filled_bar__gDcZy"};
var classes$1 = {"progress_bar":"progress-module_progress_bar__QisS6","filled_bar":"progress-module_filled_bar__gDcZy"};

@@ -186,3 +180,3 @@ function Progress(props) {

return React.createElement("div", {
className: classes$4.progress_bar,
className: classes$1.progress_bar,
style: {

@@ -196,3 +190,3 @@ backgroundColor: unfilledColor || progressBarColors.unfilled

}, React.createElement("div", {
className: classes$4.filled_bar,
className: classes$1.filled_bar,
style: {

@@ -205,4 +199,2 @@ width: percentage + "%",

var classes$5 = {"container":"progressBar-module_container__cq1Qv","inner_container":"progressBar-module_inner_container__Ig-ty","subtext":"progressBar-module_subtext__bfp0o","percent_text":"progressBar-module_percent_text__h5xUT"};
function RatingBars(props) {

@@ -259,3 +251,3 @@ var _props$data = props.data,

return React.createElement("div", {
className: classes$5.container
className: 'container'
}, combinedData.map(function (item, index) {

@@ -267,3 +259,3 @@ var count = item.count,

key: index + count,
className: clsx(classes$5.inner_container, className),
className: clsx('inner_container', className),
onClick: function onClick() {

@@ -273,3 +265,3 @@ return _onClick && _onClick(item);

}, options != null && options.progressBarText ? options.progressBarText(item) : React.createElement("span", {
className: classes$5.subtext
className: 'subtext'
}, rating, "\xA0stars"), React.createElement(Progress, {

@@ -283,3 +275,3 @@ rating: rating,

}), React.createElement("div", null, !(options != null && options.percentage) ? React.createElement("span", {
className: classes$5.percent_text
className: 'percent_text'
}, Math.ceil(percent), " %") : React.createElement(React.Fragment, null, options.percentage(percent, item), " ")));

@@ -299,3 +291,3 @@ }));

return React.createElement("div", {
className: classes$3.container
className: 'ratings_container'
}, React.createElement(StarRating$1, {

@@ -302,0 +294,0 @@ data: data,

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

{"version":3,"file":"react-custom-ratings.cjs.development.js","sources":["../src/utilis/clsx.tsx","../src/Consts/colors.ts","../src/components/Rating/FilledStarRating/index.tsx","../src/components/Rating/UnfilledStarRating/index.tsx","../src/components/Rating/Rating.tsx","../src/components/ProgressBar/Progress/Progress.tsx","../src/components/ProgressBar/ProgressBar.tsx","../src/components/Ratings/Ratings.tsx"],"sourcesContent":["export const clsx = (...classes: string[]) => {\n return classes\n .filter(Boolean)\n .map((className) => className.trim())\n .join(' ');\n};\n","export const progressBarColors = { filled: '#ffa41c', unfilled: '#f0f2f2' };\nexport const starColors = { filled: '#ffa41c', unfilled: '#ffa41c' };\n","import React from 'react';\nimport classes from './filled.module.css';\nimport { Data } from '../../../Types/Data';\nimport { clsx } from '../../../utilis/clsx';\nimport { starColors } from '../../../Consts/colors';\n\ninterface Props {\n data: Data[];\n filledColor?: string;\n ratingIconClassname?: string;\n FilledRatingIcon: React.ReactElement;\n width: string;\n}\n\n// eslint-disable-next-line\nfunction FilledStarRating(props: Props) {\n const { data, filledColor = '', ratingIconClassname = '', FilledRatingIcon, width } = props;\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n\n return (\n <div className={classes.filled} style={{ width }}>\n {[...Array(numberOfRating)].map((_, i) => (\n <span\n key={`unfilled-star custom icon ${i}`}\n className={clsx(classes.star, ratingIconClassname)}\n style={{\n color: filledColor || starColors.filled\n }}\n >\n {FilledRatingIcon}\n </span>\n ))}\n </div>\n );\n}\n\nexport default FilledStarRating;\n","/*eslint-disable*/\nimport React from 'react';\nimport FilledStarRating from '../FilledStarRating';\nimport classes from './Unfilled.module.css';\nimport { Data } from '../../../Types/Data';\nimport { clsx } from '../../../utilis/clsx';\nimport { starColors } from '../../../Consts/colors';\n\ninterface Props {\n data: Data[];\n filledColor?: string;\n unfilledColor?: string;\n ratingIconClassname?: string;\n FilledRatingIcon: React.ReactElement;\n UnfilledRatingIcon: React.ReactElement;\n width: string;\n}\n\nconst StarRating = (props: Props) => {\n const {\n data,\n filledColor,\n unfilledColor,\n ratingIconClassname = '',\n FilledRatingIcon,\n UnfilledRatingIcon,\n width\n } = props;\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n return (\n <div className={classes.unfilled}>\n {[...Array(numberOfRating)].map((_, i) => (\n <span\n key={`unfilled-star custom icon ${i}`}\n // eslint-disable-next-line no-unneeded-ternary\n className={clsx(classes.star, ratingIconClassname)}\n style={{\n // eslint-disable-next-line no-unneeded-ternary\n color: unfilledColor || starColors.unfilled\n }}\n >\n {unfilledColor ? FilledRatingIcon : UnfilledRatingIcon}\n </span>\n ))}\n <FilledStarRating\n data={data}\n filledColor={filledColor}\n ratingIconClassname={ratingIconClassname}\n FilledRatingIcon={FilledRatingIcon}\n width={width}\n />\n </div>\n );\n};\n\nexport default StarRating;\n","import React from 'react';\nimport { AiOutlineStar, AiFillStar } from 'react-icons/ai';\nimport UnfilledStartRating from './UnfilledStarRating';\nimport classes from './starRating.module.css';\nimport { RatingHeaderType } from '../../Types/RatingHeader';\nimport { clsx } from '../../utilis/clsx';\n\ninterface PercentageObj {\n [key: string]: number;\n}\n\n// eslint-disable-next-line space-before-function-paren\nfunction StarRating(props: RatingHeaderType) {\n const { data, options = {} } = props;\n const {\n filledColor,\n unfilledColor,\n ratingIconClassname,\n show = true,\n className = '',\n FilledRatingIcon = <AiFillStar />,\n UnfilledRatingIcon = <AiOutlineStar />,\n headerText\n } = options;\n\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n const totalCount = data.reduce((acc, obj) => acc + obj.count, 0);\n const per: PercentageObj = {};\n let totalPercentage = 0;\n let starPercentageRounded = '';\n\n data.forEach((rating) => {\n const perOfIndividual = rating.count / totalCount;\n const key = `${rating.rating}`;\n per[key] = perOfIndividual;\n });\n\n for (const x in per) {\n totalPercentage += Number(x) * per[x];\n }\n const percentage = (Number(totalPercentage.toFixed(2)) / numberOfRating) * 100;\n starPercentageRounded = `${percentage}%`;\n return (\n <>\n {show && (\n <div className={classes.starRating}>\n <UnfilledStartRating\n data={data}\n filledColor={filledColor}\n unfilledColor={unfilledColor}\n ratingIconClassname={ratingIconClassname}\n FilledRatingIcon={FilledRatingIcon}\n UnfilledRatingIcon={UnfilledRatingIcon}\n width={starPercentageRounded}\n />\n {headerText?.(totalPercentage) || (\n <p className={clsx(classes.rating, className)}>\n {totalPercentage.toFixed(2)} out of {numberOfRating}\n </p>\n )}\n </div>\n )}\n </>\n );\n}\n\nexport default StarRating;\n","import React from 'react';\nimport { progressBarColors } from '../../../Consts/colors';\nimport classes from './progress.module.css';\n\ninterface Props {\n rating: number;\n value: number;\n total: number;\n percentage: number;\n filledColor?: string;\n unfilledColor?: string;\n}\n\n// eslint-disable-next-line space-before-function-paren\nfunction Progress(props: Props) {\n const { percentage, filledColor, unfilledColor } = props;\n\n return (\n <div\n className={classes.progress_bar}\n style={{\n backgroundColor: unfilledColor || progressBarColors.unfilled\n }}\n role=\"progressbar\"\n aria-valuenow={40}\n aria-valuemax={20}\n aria-valuemin={0}\n >\n <div\n className={classes.filled_bar}\n style={{\n width: `${percentage}%`,\n backgroundColor: filledColor || progressBarColors.filled\n }}\n ></div>\n </div>\n );\n}\n\nexport default Progress;\n","import React from 'react';\nimport { ProgressBarProps } from '../../Types/ProgressBar';\nimport { clsx } from '../../utilis/clsx';\nimport Progress from './Progress/Progress';\nimport classes from './progressBar.module.css';\n\n// eslint-disable-next-line space-before-function-paren\nfunction RatingBars(props: ProgressBarProps) {\n const { data = [], options = {} } = props;\n const { className = '', filledColor, unfilledColor, onClick } = options;\n\n interface InitialGroupedObj {\n [key: number]: number;\n }\n\n const initialGroupedObj: InitialGroupedObj = {};\n\n const groupedData = data.reduce((acc, obj) => {\n if (acc[obj.rating]) {\n return { ...acc, [obj.rating]: acc[obj.rating] + obj.count };\n } else {\n return { ...acc, [obj.rating]: obj.count };\n }\n }, initialGroupedObj);\n\n const maximumRating = Math.max(...data.map((data) => data.rating));\n const possibleRatings = [...Array(maximumRating)].map((_, i) => i + 1);\n\n const addMissedRating: InitialGroupedObj = possibleRatings.reduce((acc, rating) => {\n if (groupedData[rating]) {\n return { ...acc, [rating]: groupedData[rating] };\n } else {\n return { ...acc, [rating]: 0 };\n }\n }, {});\n\n const combinedData = Object.entries(addMissedRating).map(([key, value]) => ({\n count: value,\n rating: Number(key)\n }));\n\n const total = combinedData.reduce(function (acc, obj) {\n return acc + obj.count;\n }, 0);\n\n return (\n <div className={classes.container}>\n {combinedData.map((item, index) => {\n const { count, rating } = item;\n const percent = (count * 100) / total || 0;\n\n return (\n <div\n key={index + count}\n className={clsx(classes.inner_container, className)}\n onClick={() => onClick && onClick(item)}>\n {options?.progressBarText ? (\n options.progressBarText(item)\n ) : (\n <span className={classes.subtext}>{rating}&nbsp;stars</span>\n )}\n\n <Progress\n rating={rating}\n value={count}\n total={total}\n percentage={percent}\n filledColor={filledColor}\n unfilledColor={unfilledColor}\n />\n\n <div>\n {!options?.percentage ? (\n <span className={classes.percent_text}>{Math.ceil(percent)} %</span>\n ) : (\n <React.Fragment>{options.percentage(percent, item)} </React.Fragment>\n )}\n </div>\n </div>\n );\n })}\n </div>\n );\n}\n\nexport default RatingBars;\n","import React from 'react';\nimport StarRating from '../Rating/Rating';\nimport classes from './ratings.module.css';\nimport { RatingsProps } from '../../Types/Ratings';\nimport RatingBars from '../ProgressBar/ProgressBar';\n\nconst Ratings = ({\n data,\n options = {\n progressBar: {},\n rating: {}\n }\n}: RatingsProps) => {\n const { progressBar, rating } = options;\n\n return (\n <div className={classes.container}>\n <StarRating\n data={data}\n options={{\n show: rating?.show,\n filledColor: rating?.filledColor,\n unfilledColor: rating?.unfilledColor,\n ratingIconClassname: rating?.className,\n className: rating?.className,\n FilledRatingIcon: rating?.FilledRatingIcon,\n UnfilledRatingIcon: rating?.UnfilledRatingIcon,\n headerText: rating?.headerText\n }}\n />\n <RatingBars\n data={data}\n options={{\n filledColor: progressBar?.filledColor,\n unfilledColor: progressBar?.unfilledColor,\n className: progressBar?.className,\n percentage: progressBar?.percentage,\n progressBarText: progressBar?.progressBarText,\n onClick: progressBar?.onClick\n }}\n />\n </div>\n );\n};\n\nexport default Ratings;\n"],"names":["clsx","classes","filter","Boolean","map","className","trim","join","progressBarColors","filled","unfilled","starColors","FilledStarRating","props","data","filledColor","ratingIconClassname","FilledRatingIcon","width","numberOfRating","Math","max","rating","React","style","Array","_","i","key","star","color","StarRating","unfilledColor","UnfilledRatingIcon","options","show","AiFillStar","AiOutlineStar","headerText","totalCount","reduce","acc","obj","count","per","totalPercentage","starPercentageRounded","forEach","perOfIndividual","x","Number","percentage","toFixed","starRating","UnfilledStartRating","Progress","progress_bar","backgroundColor","role","filled_bar","RatingBars","onClick","initialGroupedObj","groupedData","maximumRating","possibleRatings","addMissedRating","combinedData","Object","entries","value","total","container","item","index","percent","inner_container","progressBarText","subtext","percent_text","ceil","Fragment","Ratings","progressBar"],"mappings":";;;;;;;;;;;AAAO,IAAMA,IAAI,GAAG,SAAPA,IAAO;oCAAIC;IAAAA;;;EACtB,OAAOA,OAAO,CACXC,MADI,CACGC,OADH,EAEJC,GAFI,CAEA,UAACC,SAAD;IAAA,OAAeA,SAAS,CAACC,IAAV,EAAf;GAFA,EAGJC,IAHI,CAGC,GAHD,CAAP;AAID,CALM;;ACAA,IAAMC,iBAAiB,GAAG;EAAEC,MAAM,EAAE,SAAV;EAAqBC,QAAQ,EAAE;AAA/B,CAA1B;AACP,AAAO,IAAMC,UAAU,GAAG;EAAEF,MAAM,EAAE,SAAV;EA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WAAW,CAAEnD,aAFrB;MAGP3B,SAAS,EAAE8E,WAAF,oBAAEA,WAAW,CAAE9E,SAHjB;MAIP8C,UAAU,EAAEgC,WAAF,oBAAEA,WAAW,CAAEhC,UAJlB;MAKP0B,eAAe,EAAEM,WAAF,oBAAEA,WAAW,CAAEN,eALvB;MAMPhB,OAAO,EAAEsB,WAAF,oBAAEA,WAAW,CAAEtB;;GAR1B,CAdF,CADF;AA4BD,CArCD;;;;;;"}
{"version":3,"file":"react-custom-ratings.cjs.development.js","sources":["../src/utilis/clsx.tsx","../src/Consts/colors.ts","../src/components/Rating/FilledStarRating/index.tsx","../src/components/Rating/UnfilledStarRating/index.tsx","../src/components/Rating/Rating.tsx","../src/components/ProgressBar/Progress/Progress.tsx","../src/components/ProgressBar/ProgressBar.tsx","../src/components/Ratings/Ratings.tsx"],"sourcesContent":["export const clsx = (...classes: string[]) => {\n return classes\n .filter(Boolean)\n .map((className) => className.trim())\n .join(' ');\n};\n","export const progressBarColors = { filled: '#ffa41c', unfilled: '#f0f2f2' };\nexport const starColors = { filled: '#ffa41c', unfilled: '#ffa41c' };\n","import React from 'react';\nimport './filled.css';\nimport { Data } from '../../../Types/Data';\nimport { clsx } from '../../../utilis/clsx';\nimport { starColors } from '../../../Consts/colors';\n\ninterface Props {\n data: Data[];\n filledColor?: string;\n ratingIconClassname?: string;\n FilledRatingIcon: React.ReactElement;\n width: string;\n}\n\n// eslint-disable-next-line\nfunction FilledStarRating(props: Props) {\n const { data, filledColor = '', ratingIconClassname = '', FilledRatingIcon, width } = props;\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n\n return (\n <div className={'filled'} style={{ width }}>\n {[...Array(numberOfRating)].map((_, i) => (\n <span\n key={`unfilled-star custom icon ${i}`}\n className={clsx('star', ratingIconClassname)}\n style={{\n color: filledColor || starColors.filled\n }}\n >\n {FilledRatingIcon}\n </span>\n ))}\n </div>\n );\n}\n\nexport default FilledStarRating;\n","/*eslint-disable*/\nimport React from 'react';\nimport FilledStarRating from '../FilledStarRating';\nimport classes from './Unfilled.module.css';\nimport { Data } from '../../../Types/Data';\nimport { clsx } from '../../../utilis/clsx';\nimport { starColors } from '../../../Consts/colors';\n\ninterface Props {\n data: Data[];\n filledColor?: string;\n unfilledColor?: string;\n ratingIconClassname?: string;\n FilledRatingIcon: React.ReactElement;\n UnfilledRatingIcon: React.ReactElement;\n width: string;\n}\n\nconst StarRating = (props: Props) => {\n const {\n data,\n filledColor,\n unfilledColor,\n ratingIconClassname = '',\n FilledRatingIcon,\n UnfilledRatingIcon,\n width\n } = props;\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n return (\n <div className={classes.unfilled}>\n {[...Array(numberOfRating)].map((_, i) => (\n <span\n key={`unfilled-star custom icon ${i}`}\n // eslint-disable-next-line no-unneeded-ternary\n className={clsx(classes.star, ratingIconClassname)}\n style={{\n // eslint-disable-next-line no-unneeded-ternary\n color: unfilledColor || starColors.unfilled\n }}\n >\n {unfilledColor ? FilledRatingIcon : UnfilledRatingIcon}\n </span>\n ))}\n <FilledStarRating\n data={data}\n filledColor={filledColor}\n ratingIconClassname={ratingIconClassname}\n FilledRatingIcon={FilledRatingIcon}\n width={width}\n />\n </div>\n );\n};\n\nexport default StarRating;\n","import React from 'react';\nimport { AiOutlineStar, AiFillStar } from 'react-icons/ai';\nimport UnfilledStartRating from './UnfilledStarRating';\nimport './starRating.css';\nimport { RatingHeaderType } from '../../Types/RatingHeader';\nimport { clsx } from '../../utilis/clsx';\n\ninterface PercentageObj {\n [key: string]: number;\n}\n\n// eslint-disable-next-line space-before-function-paren\nfunction StarRating(props: RatingHeaderType) {\n const { data, options = {} } = props;\n const {\n filledColor,\n unfilledColor,\n ratingIconClassname,\n show = true,\n className = '',\n FilledRatingIcon = <AiFillStar />,\n UnfilledRatingIcon = <AiOutlineStar />,\n headerText\n } = options;\n\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n const totalCount = data.reduce((acc, obj) => acc + obj.count, 0);\n const per: PercentageObj = {};\n let totalPercentage = 0;\n let starPercentageRounded = '';\n\n data.forEach((rating) => {\n const perOfIndividual = rating.count / totalCount;\n const key = `${rating.rating}`;\n per[key] = perOfIndividual;\n });\n\n for (const x in per) {\n totalPercentage += Number(x) * per[x];\n }\n const percentage = (Number(totalPercentage.toFixed(2)) / numberOfRating) * 100;\n starPercentageRounded = `${percentage}%`;\n return (\n <>\n {show && (\n <div className={'starRating'}>\n <UnfilledStartRating\n data={data}\n filledColor={filledColor}\n unfilledColor={unfilledColor}\n ratingIconClassname={ratingIconClassname}\n FilledRatingIcon={FilledRatingIcon}\n UnfilledRatingIcon={UnfilledRatingIcon}\n width={starPercentageRounded}\n />\n {headerText?.(totalPercentage) || (\n <p className={clsx('rating', className)}>\n {totalPercentage.toFixed(2)} out of {numberOfRating}\n </p>\n )}\n </div>\n )}\n </>\n );\n}\n\nexport default StarRating;\n","import React from 'react';\nimport { progressBarColors } from '../../../Consts/colors';\nimport classes from './progress.module.css';\n\ninterface Props {\n rating: number;\n value: number;\n total: number;\n percentage: number;\n filledColor?: string;\n unfilledColor?: string;\n}\n\n// eslint-disable-next-line space-before-function-paren\nfunction Progress(props: Props) {\n const { percentage, filledColor, unfilledColor } = props;\n\n return (\n <div\n className={classes.progress_bar}\n style={{\n backgroundColor: unfilledColor || progressBarColors.unfilled\n }}\n role=\"progressbar\"\n aria-valuenow={40}\n aria-valuemax={20}\n aria-valuemin={0}\n >\n <div\n className={classes.filled_bar}\n style={{\n width: `${percentage}%`,\n backgroundColor: filledColor || progressBarColors.filled\n }}\n ></div>\n </div>\n );\n}\n\nexport default Progress;\n","import React from 'react';\nimport { ProgressBarProps } from '../../Types/ProgressBar';\nimport { clsx } from '../../utilis/clsx';\nimport Progress from './Progress/Progress';\nimport './progressBar.css';\n\n// eslint-disable-next-line space-before-function-paren\nfunction RatingBars(props: ProgressBarProps) {\n const { data = [], options = {} } = props;\n const { className = '', filledColor, unfilledColor, onClick } = options;\n\n interface InitialGroupedObj {\n [key: number]: number;\n }\n\n const initialGroupedObj: InitialGroupedObj = {};\n\n const groupedData = data.reduce((acc, obj) => {\n if (acc[obj.rating]) {\n return { ...acc, [obj.rating]: acc[obj.rating] + obj.count };\n } else {\n return { ...acc, [obj.rating]: obj.count };\n }\n }, initialGroupedObj);\n\n const maximumRating = Math.max(...data.map((data) => data.rating));\n const possibleRatings = [...Array(maximumRating)].map((_, i) => i + 1);\n\n const addMissedRating: InitialGroupedObj = possibleRatings.reduce((acc, rating) => {\n if (groupedData[rating]) {\n return { ...acc, [rating]: groupedData[rating] };\n } else {\n return { ...acc, [rating]: 0 };\n }\n }, {});\n\n const combinedData = Object.entries(addMissedRating).map(([key, value]) => ({\n count: value,\n rating: Number(key)\n }));\n\n const total = combinedData.reduce(function (acc, obj) {\n return acc + obj.count;\n }, 0);\n\n return (\n <div className={'container'}>\n {combinedData.map((item, index) => {\n const { count, rating } = item;\n const percent = (count * 100) / total || 0;\n\n return (\n <div\n key={index + count}\n className={clsx('inner_container', className)}\n onClick={() => onClick && onClick(item)}\n >\n {options?.progressBarText ? (\n options.progressBarText(item)\n ) : (\n <span className={'subtext'}>{rating}&nbsp;stars</span>\n )}\n\n <Progress\n rating={rating}\n value={count}\n total={total}\n percentage={percent}\n filledColor={filledColor}\n unfilledColor={unfilledColor}\n />\n\n <div>\n {!options?.percentage ? (\n <span className={'percent_text'}>{Math.ceil(percent)} %</span>\n ) : (\n <React.Fragment>{options.percentage(percent, item)} </React.Fragment>\n )}\n </div>\n </div>\n );\n })}\n </div>\n );\n}\n\nexport default RatingBars;\n","import React from 'react';\nimport StarRating from '../Rating/Rating';\nimport './ratings.css';\nimport { RatingsProps } from '../../Types/Ratings';\nimport RatingBars from '../ProgressBar/ProgressBar';\n\nconst Ratings = ({\n data,\n options = {\n progressBar: {},\n rating: {}\n }\n}: RatingsProps) => {\n const { progressBar, rating } = options;\n\n return (\n <div className={'ratings_container'}>\n <StarRating\n data={data}\n options={{\n show: rating?.show,\n filledColor: rating?.filledColor,\n unfilledColor: rating?.unfilledColor,\n ratingIconClassname: rating?.className,\n className: rating?.className,\n FilledRatingIcon: rating?.FilledRatingIcon,\n UnfilledRatingIcon: rating?.UnfilledRatingIcon,\n headerText: rating?.headerText\n }}\n />\n <RatingBars\n data={data}\n options={{\n filledColor: progressBar?.filledColor,\n unfilledColor: progressBar?.unfilledColor,\n className: progressBar?.className,\n percentage: progressBar?.percentage,\n progressBarText: progressBar?.progressBarText,\n onClick: progressBar?.onClick\n }}\n />\n </div>\n );\n};\n\nexport default Ratings;\n"],"names":["clsx","classes","filter","Boolean","map","className","trim","join","progressBarColors","filled","unfilled","starColors","FilledStarRating","props","data","filledColor","ratingIconClassname","FilledRatingIcon","width","numberOfRating","Math","max","rating","React","style","Array","_","i","key","color","StarRating","unfilledColor","UnfilledRatingIcon","star","options","show","AiFillStar","AiOutlineStar","headerText","totalCount","reduce","acc","obj","count","per","totalPercentage","starPercentageRounded","forEach","perOfIndividual","x","Number","percentage","toFixed","UnfilledStartRating","Progress","progress_bar","backgroundColor","role","filled_bar","RatingBars","onClick","initialGroupedObj","groupedData","maximumRating","possibleRatings","addMissedRating","combinedData","Object","entries","value","total","item","index","percent","progressBarText","ceil","Fragment","Ratings","progressBar"],"mappings":";;;;;;;;;AAAO,IAAMA,IAAI,GAAG,SAAPA,IAAO;oCAAIC;IAAAA;;;EACtB,OAAOA,OAAO,CACXC,MADI,CACGC,OADH,EAEJC,GAFI,CAEA,UAACC,SAAD;IAAA,OAAeA,SAAS,CAACC,IAAV,EAAf;GAFA,EAGJC,IAHI,CAGC,GAHD,CAAP;AAID,CALM;;ACAA,IAAMC,iBAAiB,GAAG;EAAEC,MAAM,EAAE,SAAV;EAAqBC,QAAQ,EAAE;AAA/B,CAA1B;AACP,AAAO,IAAMC,UAAU,GAAG;EAAEF,MAAM,EAAE,SAAV;EAAqBC,QAAQ,EAAE;AAA/B,CAAnB;;ACcP,SAASE,gBAAT,CAA0BC,KAA1B;EACE,IAAQC,IAAR,GAAsFD,KAAtF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ArCD;;;;;;"}

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e,l=require("react-icons/ai");function t(e,n){void 0===n&&(n={});var l=n.insertAt;if(e&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===l&&t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}t(".filled-module_filled__7APsd {\n font-size: 3rem;\n position: absolute;\n top: 0;\n left: 0;\n white-space: nowrap;\n overflow: hidden;\n width: 0;\n /* overflow: hidden; */\n}\nspan {\n font-size: 3rem;\n /* overflow: hidden; */\n}\n.filled-module_star__DjRcp {\n font-size: 3rem;\n /* overflow: hidden; */\n}\n");var r=function(){for(var e=arguments.length,n=new Array(e),l=0;l<e;l++)n[l]=arguments[l];return n.filter(Boolean).map((function(e){return e.trim()})).join(" ")};function a(e){var l=e.filledColor,t=void 0===l?"":l,a=e.ratingIconClassname,o=void 0===a?"":a,i=e.FilledRatingIcon,d=e.width,s=Math.max.apply(Math,e.data.map((function(e){return e.rating})));return n.createElement("div",{className:"filled-module_filled__7APsd",style:{width:d}},[].concat(Array(s)).map((function(e,l){return n.createElement("span",{key:"unfilled-star custom icon "+l,className:r("filled-module_star__DjRcp",o),style:{color:t||"#ffa41c"}},i)})))}var o={unfilled:"Unfilled-module_unfilled__2wGJ3",filled:"Unfilled-module_filled__-I2up"};t(".Unfilled-module_unfilled__2wGJ3 {\n position: relative;\n display: inline-block;\n}\n.Unfilled-module_unfilled__2wGJ3 span {\n font-size: 3rem;\n padding: 0.1rem;\n}\n\n.Unfilled-module_unfilled__2wGJ3 .Unfilled-module_filled__-I2up {\n position: absolute;\n top: 0;\n left: 0;\n white-space: nowrap;\n overflow: hidden;\n width: 0;\n}\n");var i=function(e){var l=e.data,t=e.filledColor,i=e.unfilledColor,d=e.ratingIconClassname,s=void 0===d?"":d,c=e.FilledRatingIcon,u=e.UnfilledRatingIcon,f=e.width,m=Math.max.apply(Math,l.map((function(e){return e.rating})));return n.createElement("div",{className:o.unfilled},[].concat(Array(m)).map((function(e,l){return n.createElement("span",{key:"unfilled-star custom icon "+l,className:r(o.star,s),style:{color:i||"#ffa41c"}},i?c:u)})),n.createElement(a,{data:l,filledColor:t,ratingIconClassname:s,FilledRatingIcon:c,width:f}))};function d(e){var t=e.data,a=e.options,o=void 0===a?{}:a,d=o.filledColor,s=o.unfilledColor,c=o.ratingIconClassname,u=o.show,f=void 0===u||u,m=o.className,p=void 0===m?"":m,g=o.FilledRatingIcon,_=void 0===g?n.createElement(l.AiFillStar,null):g,v=o.UnfilledRatingIcon,h=void 0===v?n.createElement(l.AiOutlineStar,null):v,x=o.headerText,y=Math.max.apply(Math,t.map((function(e){return e.rating}))),w=t.reduce((function(e,n){return e+n.count}),0),C={},b=0;for(var E in t.forEach((function(e){C[""+e.rating]=e.count/w})),C)b+=Number(E)*C[E];var R=Number(b.toFixed(2))/y*100;return n.createElement(n.Fragment,null,f&&n.createElement("div",{className:"starRating-module_starRating__8Gp7A"},n.createElement(i,{data:t,filledColor:d,unfilledColor:s,ratingIconClassname:c,FilledRatingIcon:_,UnfilledRatingIcon:h,width:R+"%"}),(null==x?void 0:x(b))||n.createElement("p",{className:r("starRating-module_rating__WyRjo",p)},b.toFixed(2)," out of ",y)))}function s(){return(s=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var l=arguments[n];for(var t in l)Object.prototype.hasOwnProperty.call(l,t)&&(e[t]=l[t])}return e}).apply(this,arguments)}function c(e){return n.createElement("div",{className:"progress-module_progress_bar__QisS6",style:{backgroundColor:e.unfilledColor||"#f0f2f2"},role:"progressbar","aria-valuenow":40,"aria-valuemax":20,"aria-valuemin":0},n.createElement("div",{className:"progress-module_filled_bar__gDcZy",style:{width:e.percentage+"%",backgroundColor:e.filledColor||"#ffa41c"}}))}function u(e){var l=e.data,t=void 0===l?[]:l,a=e.options,o=void 0===a?{}:a,i=o.className,d=void 0===i?"":i,u=o.filledColor,f=o.unfilledColor,m=o.onClick,p=t.reduce((function(e,n){var l,t;return s({},e,e[n.rating]?((l={})[n.rating]=e[n.rating]+n.count,l):((t={})[n.rating]=n.count,t))}),{}),g=Math.max.apply(Math,t.map((function(e){return e.rating}))),_=[].concat(Array(g)).map((function(e,n){return n+1})).reduce((function(e,n){var l,t;return s({},e,p[n]?((l={})[n]=p[n],l):((t={})[n]=0,t))}),{}),v=Object.entries(_).map((function(e){return{count:e[1],rating:Number(e[0])}})),h=v.reduce((function(e,n){return e+n.count}),0);return n.createElement("div",{className:"progressBar-module_container__cq1Qv"},v.map((function(e,l){var t=e.count,a=e.rating,i=100*t/h||0;return n.createElement("div",{key:l+t,className:r("progressBar-module_inner_container__Ig-ty",d),onClick:function(){return m&&m(e)}},null!=o&&o.progressBarText?o.progressBarText(e):n.createElement("span",{className:"progressBar-module_subtext__bfp0o"},a," stars"),n.createElement(c,{rating:a,value:t,total:h,percentage:i,filledColor:u,unfilledColor:f}),n.createElement("div",null,null!=o&&o.percentage?n.createElement(n.Fragment,null,o.percentage(i,e)," "):n.createElement("span",{className:"progressBar-module_percent_text__h5xUT"},Math.ceil(i)," %")))})))}t(".starRating-module_starRating__8Gp7A {\n display: flex;\n justify-content: center;\n}\n.starRating-module_starRating__8Gp7A .starRating-module_rating__WyRjo {\n font-size: 14px;\n white-space: nowrap;\n margin-left: 1rem;\n}\n"),t(".ratings-module_container__3oVdJ {\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n justify-content: center;\n background-color: #fff;\n}\n"),t(".progress-module_progress_bar__QisS6 {\n display: flex;\n flex: 1;\n align-self: stretch;\n border-radius: 4px;\n}\n\n.progress-module_filled_bar__gDcZy {\n border-radius: 4px 0 0 4px;\n height: 100%;\n}\n"),t(".progressBar-module_container__cq1Qv {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 1.2rem;\n box-sizing: border-box;\n padding: 10px;\n}\n\n.progressBar-module_inner_container__Ig-ty {\n width: 100%;\n height: 1.2rem;\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 0.8rem;\n}\n\n.progressBar-module_subtext__bfp0o {\n font-size: 14px;\n white-space: nowrap;\n display: flex;\n}\n\n.progressBar-module_percent_text__h5xUT {\n font-size: 14px;\n white-space: nowrap;\n display: flex;\n width: 35px;\n justify-content: flex-end;\n}\n"),exports.ProgressBar=u,exports.Rating=d,exports.Ratings=function(e){var l=e.data,t=e.options,r=void 0===t?{progressBar:{},rating:{}}:t,a=r.progressBar,o=r.rating;return n.createElement("div",{className:"ratings-module_container__3oVdJ"},n.createElement(d,{data:l,options:{show:null==o?void 0:o.show,filledColor:null==o?void 0:o.filledColor,unfilledColor:null==o?void 0:o.unfilledColor,ratingIconClassname:null==o?void 0:o.className,className:null==o?void 0:o.className,FilledRatingIcon:null==o?void 0:o.FilledRatingIcon,UnfilledRatingIcon:null==o?void 0:o.UnfilledRatingIcon,headerText:null==o?void 0:o.headerText}}),n.createElement(u,{data:l,options:{filledColor:null==a?void 0:a.filledColor,unfilledColor:null==a?void 0:a.unfilledColor,className:null==a?void 0:a.className,percentage:null==a?void 0:a.percentage,progressBarText:null==a?void 0:a.progressBarText,onClick:null==a?void 0:a.onClick}}))};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,n=(e=require("react"))&&"object"==typeof e&&"default"in e?e.default:e,t=require("react-icons/ai");function l(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===t&&l.firstChild?l.insertBefore(r,l.firstChild):l.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}l(".filled {\n font-size: 3rem;\n position: absolute;\n top: 0;\n left: 0;\n white-space: nowrap;\n overflow: hidden;\n width: 0;\n /* overflow: hidden; */\n}\nspan {\n font-size: 3rem;\n /* overflow: hidden; */\n}\n.star {\n font-size: 3rem;\n /* overflow: hidden; */\n}\n");var r=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.filter(Boolean).map((function(e){return e.trim()})).join(" ")};function a(e){var t=e.filledColor,l=void 0===t?"":t,a=e.ratingIconClassname,i=void 0===a?"":a,o=e.FilledRatingIcon,d=e.width,s=Math.max.apply(Math,e.data.map((function(e){return e.rating})));return n.createElement("div",{className:"filled",style:{width:d}},[].concat(Array(s)).map((function(e,t){return n.createElement("span",{key:"unfilled-star custom icon "+t,className:r("star",i),style:{color:l||"#ffa41c"}},o)})))}var i={unfilled:"Unfilled-module_unfilled__2wGJ3",filled:"Unfilled-module_filled__-I2up"};l(".Unfilled-module_unfilled__2wGJ3 {\n position: relative;\n display: inline-block;\n}\n.Unfilled-module_unfilled__2wGJ3 span {\n font-size: 3rem;\n padding: 0.1rem;\n}\n\n.Unfilled-module_unfilled__2wGJ3 .Unfilled-module_filled__-I2up {\n position: absolute;\n top: 0;\n left: 0;\n white-space: nowrap;\n overflow: hidden;\n width: 0;\n}\n");var o=function(e){var t=e.data,l=e.filledColor,o=e.unfilledColor,d=e.ratingIconClassname,s=void 0===d?"":d,c=e.FilledRatingIcon,u=e.UnfilledRatingIcon,f=e.width,p=Math.max.apply(Math,t.map((function(e){return e.rating})));return n.createElement("div",{className:i.unfilled},[].concat(Array(p)).map((function(e,t){return n.createElement("span",{key:"unfilled-star custom icon "+t,className:r(i.star,s),style:{color:o||"#ffa41c"}},o?c:u)})),n.createElement(a,{data:t,filledColor:l,ratingIconClassname:s,FilledRatingIcon:c,width:f}))};function d(e){var l=e.data,a=e.options,i=void 0===a?{}:a,d=i.filledColor,s=i.unfilledColor,c=i.ratingIconClassname,u=i.show,f=void 0===u||u,p=i.className,m=void 0===p?"":p,g=i.FilledRatingIcon,v=void 0===g?n.createElement(t.AiFillStar,null):g,h=i.UnfilledRatingIcon,x=void 0===h?n.createElement(t.AiOutlineStar,null):h,_=i.headerText,y=Math.max.apply(Math,l.map((function(e){return e.rating}))),w=l.reduce((function(e,n){return e+n.count}),0),C={},b=0;for(var E in l.forEach((function(e){C[""+e.rating]=e.count/w})),C)b+=Number(E)*C[E];var N=Number(b.toFixed(2))/y*100;return n.createElement(n.Fragment,null,f&&n.createElement("div",{className:"starRating"},n.createElement(o,{data:l,filledColor:d,unfilledColor:s,ratingIconClassname:c,FilledRatingIcon:v,UnfilledRatingIcon:x,width:N+"%"}),(null==_?void 0:_(b))||n.createElement("p",{className:r("rating",m)},b.toFixed(2)," out of ",y)))}function s(){return(s=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(e[l]=t[l])}return e}).apply(this,arguments)}function c(e){return n.createElement("div",{className:"progress-module_progress_bar__QisS6",style:{backgroundColor:e.unfilledColor||"#f0f2f2"},role:"progressbar","aria-valuenow":40,"aria-valuemax":20,"aria-valuemin":0},n.createElement("div",{className:"progress-module_filled_bar__gDcZy",style:{width:e.percentage+"%",backgroundColor:e.filledColor||"#ffa41c"}}))}function u(e){var t=e.data,l=void 0===t?[]:t,a=e.options,i=void 0===a?{}:a,o=i.className,d=void 0===o?"":o,u=i.filledColor,f=i.unfilledColor,p=i.onClick,m=l.reduce((function(e,n){var t,l;return s({},e,e[n.rating]?((t={})[n.rating]=e[n.rating]+n.count,t):((l={})[n.rating]=n.count,l))}),{}),g=Math.max.apply(Math,l.map((function(e){return e.rating}))),v=[].concat(Array(g)).map((function(e,n){return n+1})).reduce((function(e,n){var t,l;return s({},e,m[n]?((t={})[n]=m[n],t):((l={})[n]=0,l))}),{}),h=Object.entries(v).map((function(e){return{count:e[1],rating:Number(e[0])}})),x=h.reduce((function(e,n){return e+n.count}),0);return n.createElement("div",{className:"container"},h.map((function(e,t){var l=e.count,a=e.rating,o=100*l/x||0;return n.createElement("div",{key:t+l,className:r("inner_container",d),onClick:function(){return p&&p(e)}},null!=i&&i.progressBarText?i.progressBarText(e):n.createElement("span",{className:"subtext"},a," stars"),n.createElement(c,{rating:a,value:l,total:x,percentage:o,filledColor:u,unfilledColor:f}),n.createElement("div",null,null!=i&&i.percentage?n.createElement(n.Fragment,null,i.percentage(o,e)," "):n.createElement("span",{className:"percent_text"},Math.ceil(o)," %")))})))}l(".starRating {\n display: flex;\n justify-content: center;\n}\n.starRating .rating {\n font-size: 14px;\n white-space: nowrap;\n margin-left: 1rem;\n}\n"),l(".ratings_container {\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n justify-content: center;\n background-color: #fff;\n}\n"),l(".progress-module_progress_bar__QisS6 {\n display: flex;\n flex: 1;\n align-self: stretch;\n border-radius: 4px;\n}\n\n.progress-module_filled_bar__gDcZy {\n border-radius: 4px 0 0 4px;\n height: 100%;\n}\n"),l(".container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 1.2rem;\n box-sizing: border-box;\n padding: 10px;\n}\n\n.inner_container {\n width: 100%;\n height: 1.2rem;\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 0.8rem;\n}\n\n.subtext {\n font-size: 14px;\n white-space: nowrap;\n display: flex;\n}\n\n.percent_text {\n font-size: 14px;\n white-space: nowrap;\n display: flex;\n width: 35px;\n justify-content: flex-end;\n}\n"),exports.ProgressBar=u,exports.Rating=d,exports.Ratings=function(e){var t=e.data,l=e.options,r=void 0===l?{progressBar:{},rating:{}}:l,a=r.progressBar,i=r.rating;return n.createElement("div",{className:"ratings_container"},n.createElement(d,{data:t,options:{show:null==i?void 0:i.show,filledColor:null==i?void 0:i.filledColor,unfilledColor:null==i?void 0:i.unfilledColor,ratingIconClassname:null==i?void 0:i.className,className:null==i?void 0:i.className,FilledRatingIcon:null==i?void 0:i.FilledRatingIcon,UnfilledRatingIcon:null==i?void 0:i.UnfilledRatingIcon,headerText:null==i?void 0:i.headerText}}),n.createElement(u,{data:t,options:{filledColor:null==a?void 0:a.filledColor,unfilledColor:null==a?void 0:a.unfilledColor,className:null==a?void 0:a.className,percentage:null==a?void 0:a.percentage,progressBarText:null==a?void 0:a.progressBarText,onClick:null==a?void 0:a.onClick}}))};
//# sourceMappingURL=react-custom-ratings.cjs.production.min.js.map

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

{"version":3,"file":"react-custom-ratings.cjs.production.min.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/utilis/clsx.tsx","../src/components/Rating/FilledStarRating/index.tsx","../src/Consts/colors.ts","../src/components/Rating/UnfilledStarRating/index.tsx","../src/components/Rating/Rating.tsx","../src/components/ProgressBar/Progress/Progress.tsx","../src/components/ProgressBar/ProgressBar.tsx","../src/components/Ratings/Ratings.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","export const clsx = (...classes: string[]) => {\n return classes\n .filter(Boolean)\n .map((className) => className.trim())\n .join(' ');\n};\n","import React from 'react';\nimport classes from './filled.module.css';\nimport { Data } from '../../../Types/Data';\nimport { clsx } from '../../../utilis/clsx';\nimport { starColors } from '../../../Consts/colors';\n\ninterface Props {\n data: Data[];\n filledColor?: string;\n ratingIconClassname?: string;\n FilledRatingIcon: React.ReactElement;\n width: string;\n}\n\n// eslint-disable-next-line\nfunction FilledStarRating(props: Props) {\n const { data, filledColor = '', ratingIconClassname = '', FilledRatingIcon, width } = props;\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n\n return (\n <div className={classes.filled} style={{ width }}>\n {[...Array(numberOfRating)].map((_, i) => (\n <span\n key={`unfilled-star custom icon ${i}`}\n className={clsx(classes.star, ratingIconClassname)}\n style={{\n color: filledColor || starColors.filled\n }}\n >\n {FilledRatingIcon}\n </span>\n ))}\n </div>\n );\n}\n\nexport default FilledStarRating;\n","export const progressBarColors = { filled: '#ffa41c', unfilled: '#f0f2f2' };\nexport const starColors = { filled: '#ffa41c', unfilled: '#ffa41c' };\n","/*eslint-disable*/\nimport React from 'react';\nimport FilledStarRating from '../FilledStarRating';\nimport classes from './Unfilled.module.css';\nimport { Data } from '../../../Types/Data';\nimport { clsx } from '../../../utilis/clsx';\nimport { starColors } from '../../../Consts/colors';\n\ninterface Props {\n data: Data[];\n filledColor?: string;\n unfilledColor?: string;\n ratingIconClassname?: string;\n FilledRatingIcon: React.ReactElement;\n UnfilledRatingIcon: React.ReactElement;\n width: string;\n}\n\nconst StarRating = (props: Props) => {\n const {\n data,\n filledColor,\n unfilledColor,\n ratingIconClassname = '',\n FilledRatingIcon,\n UnfilledRatingIcon,\n width\n } = props;\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n return (\n <div className={classes.unfilled}>\n {[...Array(numberOfRating)].map((_, i) => (\n <span\n key={`unfilled-star custom icon ${i}`}\n // eslint-disable-next-line no-unneeded-ternary\n className={clsx(classes.star, ratingIconClassname)}\n style={{\n // eslint-disable-next-line no-unneeded-ternary\n color: unfilledColor || starColors.unfilled\n }}\n >\n {unfilledColor ? FilledRatingIcon : UnfilledRatingIcon}\n </span>\n ))}\n <FilledStarRating\n data={data}\n filledColor={filledColor}\n ratingIconClassname={ratingIconClassname}\n FilledRatingIcon={FilledRatingIcon}\n width={width}\n />\n </div>\n );\n};\n\nexport default StarRating;\n","import React from 'react';\nimport { AiOutlineStar, AiFillStar } from 'react-icons/ai';\nimport UnfilledStartRating from './UnfilledStarRating';\nimport classes from './starRating.module.css';\nimport { RatingHeaderType } from '../../Types/RatingHeader';\nimport { clsx } from '../../utilis/clsx';\n\ninterface PercentageObj {\n [key: string]: number;\n}\n\n// eslint-disable-next-line space-before-function-paren\nfunction StarRating(props: RatingHeaderType) {\n const { data, options = {} } = props;\n const {\n filledColor,\n unfilledColor,\n ratingIconClassname,\n show = true,\n className = '',\n FilledRatingIcon = <AiFillStar />,\n UnfilledRatingIcon = <AiOutlineStar />,\n headerText\n } = options;\n\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n const totalCount = data.reduce((acc, obj) => acc + obj.count, 0);\n const per: PercentageObj = {};\n let totalPercentage = 0;\n let starPercentageRounded = '';\n\n data.forEach((rating) => {\n const perOfIndividual = rating.count / totalCount;\n const key = `${rating.rating}`;\n per[key] = perOfIndividual;\n });\n\n for (const x in per) {\n totalPercentage += Number(x) * per[x];\n }\n const percentage = (Number(totalPercentage.toFixed(2)) / numberOfRating) * 100;\n starPercentageRounded = `${percentage}%`;\n return (\n <>\n {show && (\n <div className={classes.starRating}>\n <UnfilledStartRating\n data={data}\n filledColor={filledColor}\n unfilledColor={unfilledColor}\n ratingIconClassname={ratingIconClassname}\n FilledRatingIcon={FilledRatingIcon}\n UnfilledRatingIcon={UnfilledRatingIcon}\n width={starPercentageRounded}\n />\n {headerText?.(totalPercentage) || (\n <p className={clsx(classes.rating, className)}>\n {totalPercentage.toFixed(2)} out of {numberOfRating}\n </p>\n )}\n </div>\n )}\n </>\n );\n}\n\nexport default StarRating;\n","import React from 'react';\nimport { progressBarColors } from '../../../Consts/colors';\nimport classes from './progress.module.css';\n\ninterface Props {\n rating: number;\n value: number;\n total: number;\n percentage: number;\n filledColor?: string;\n unfilledColor?: string;\n}\n\n// eslint-disable-next-line space-before-function-paren\nfunction Progress(props: Props) {\n const { percentage, filledColor, unfilledColor } = props;\n\n return (\n <div\n className={classes.progress_bar}\n style={{\n backgroundColor: unfilledColor || progressBarColors.unfilled\n }}\n role=\"progressbar\"\n aria-valuenow={40}\n aria-valuemax={20}\n aria-valuemin={0}\n >\n <div\n className={classes.filled_bar}\n style={{\n width: `${percentage}%`,\n backgroundColor: filledColor || progressBarColors.filled\n }}\n ></div>\n </div>\n );\n}\n\nexport default Progress;\n","import React from 'react';\nimport { ProgressBarProps } from '../../Types/ProgressBar';\nimport { clsx } from '../../utilis/clsx';\nimport Progress from './Progress/Progress';\nimport classes from './progressBar.module.css';\n\n// eslint-disable-next-line space-before-function-paren\nfunction RatingBars(props: ProgressBarProps) {\n const { data = [], options = {} } = props;\n const { className = '', filledColor, unfilledColor, onClick } = options;\n\n interface InitialGroupedObj {\n [key: number]: number;\n }\n\n const initialGroupedObj: InitialGroupedObj = {};\n\n const groupedData = data.reduce((acc, obj) => {\n if (acc[obj.rating]) {\n return { ...acc, [obj.rating]: acc[obj.rating] + obj.count };\n } else {\n return { ...acc, [obj.rating]: obj.count };\n }\n }, initialGroupedObj);\n\n const maximumRating = Math.max(...data.map((data) => data.rating));\n const possibleRatings = [...Array(maximumRating)].map((_, i) => i + 1);\n\n const addMissedRating: InitialGroupedObj = possibleRatings.reduce((acc, rating) => {\n if (groupedData[rating]) {\n return { ...acc, [rating]: groupedData[rating] };\n } else {\n return { ...acc, [rating]: 0 };\n }\n }, {});\n\n const combinedData = Object.entries(addMissedRating).map(([key, value]) => ({\n count: value,\n rating: Number(key)\n }));\n\n const total = combinedData.reduce(function (acc, obj) {\n return acc + obj.count;\n }, 0);\n\n return (\n <div className={classes.container}>\n {combinedData.map((item, index) => {\n const { count, rating } = item;\n const percent = (count * 100) / total || 0;\n\n return (\n <div\n key={index + count}\n className={clsx(classes.inner_container, className)}\n onClick={() => onClick && onClick(item)}>\n {options?.progressBarText ? (\n options.progressBarText(item)\n ) : (\n <span className={classes.subtext}>{rating}&nbsp;stars</span>\n )}\n\n <Progress\n rating={rating}\n value={count}\n total={total}\n percentage={percent}\n filledColor={filledColor}\n unfilledColor={unfilledColor}\n />\n\n <div>\n {!options?.percentage ? (\n <span className={classes.percent_text}>{Math.ceil(percent)} %</span>\n ) : (\n <React.Fragment>{options.percentage(percent, item)} </React.Fragment>\n )}\n </div>\n </div>\n );\n })}\n </div>\n );\n}\n\nexport default RatingBars;\n","import React from 'react';\nimport StarRating from '../Rating/Rating';\nimport classes from './ratings.module.css';\nimport { RatingsProps } from '../../Types/Ratings';\nimport RatingBars from '../ProgressBar/ProgressBar';\n\nconst Ratings = ({\n data,\n options = {\n progressBar: {},\n rating: {}\n }\n}: RatingsProps) => {\n const { progressBar, rating } = options;\n\n return (\n <div className={classes.container}>\n <StarRating\n data={data}\n options={{\n show: rating?.show,\n filledColor: rating?.filledColor,\n unfilledColor: rating?.unfilledColor,\n ratingIconClassname: rating?.className,\n className: rating?.className,\n FilledRatingIcon: rating?.FilledRatingIcon,\n UnfilledRatingIcon: rating?.UnfilledRatingIcon,\n headerText: rating?.headerText\n }}\n />\n <RatingBars\n data={data}\n options={{\n filledColor: progressBar?.filledColor,\n unfilledColor: progressBar?.unfilledColor,\n className: progressBar?.className,\n percentage: progressBar?.percentage,\n progressBarText: progressBar?.progressBarText,\n onClick: progressBar?.onClick\n }}\n />\n </div>\n );\n};\n\nexport default Ratings;\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","clsx","classes","filter","Boolean","map","className","trim","join","FilledStarRating","props","filledColor","ratingIconClassname","FilledRatingIcon","width","numberOfRating","Math","max","data","rating","React","Array","_","i","key","color","StarRating","unfilledColor","UnfilledRatingIcon","unfilled","star","options","show","AiFillStar","AiOutlineStar","headerText","totalCount","reduce","acc","obj","count","per","totalPercentage","x","forEach","Number","percentage","toFixed","UnfilledStartRating","Progress","backgroundColor","role","RatingBars","onClick","groupedData","maximumRating","addMissedRating","combinedData","Object","entries","total","item","index","percent","progressBarText","value","Fragment","ceil","progressBar"],"mappings":"4KAAA,SAASA,EAAYC,EAAKC,QACX,IAARA,IAAiBA,EAAM,IAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,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d,WAAYiB,EACZpD,YAAaA,EACbgB,cAAeA,IAGjBP,iCACIW,GAAAA,EAASe,WAGT1B,gBAACA,EAAM8C,cAAUnC,EAAQe,WAAWiB,EAASF,QAF7CzC,wBAAMd,oDAAkCU,KAAKmD,KAAKJ,8yCCnElD,gBACd7C,IAAAA,SACAa,QAAAA,aAAU,CACRqC,YAAa,GACbjD,OAAQ,MAGFiD,EAAwBrC,EAAxBqC,YAAajD,EAAWY,EAAXZ,OAErB,OACEC,uBAAKd,6CACHc,gBAACM,GACCR,KAAMA,EACNa,QAAS,CACPC,WAAMb,SAAAA,EAAQa,KACdrB,kBAAaQ,SAAAA,EAAQR,YACrBgB,oBAAeR,SAAAA,EAAQQ,cACvBf,0BAAqBO,SAAAA,EAAQb,UAC7BA,gBAAWa,SAAAA,EAAQb,UACnBO,uBAAkBM,SAAAA,EAAQN,iBAC1Be,yBAAoBT,SAAAA,EAAQS,mBAC5BO,iBAAYhB,SAAAA,EAAQgB,cAGxBf,gBAACgC,GACClC,KAAMA,EACNa,QAAS,CACPpB,kBAAayD,SAAAA,EAAazD,YAC1BgB,oBAAeyC,SAAAA,EAAazC,cAC5BrB,gBAAW8D,SAAAA,EAAa9D,UACxBwC,iBAAYsB,SAAAA,EAAatB,WACzBkB,sBAAiBI,SAAAA,EAAaJ,gBAC9BX,cAASe,SAAAA,EAAaf"}
{"version":3,"file":"react-custom-ratings.cjs.production.min.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/utilis/clsx.tsx","../src/components/Rating/FilledStarRating/index.tsx","../src/Consts/colors.ts","../src/components/Rating/UnfilledStarRating/index.tsx","../src/components/Rating/Rating.tsx","../src/components/ProgressBar/Progress/Progress.tsx","../src/components/ProgressBar/ProgressBar.tsx","../src/components/Ratings/Ratings.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","export const clsx = (...classes: string[]) => {\n return classes\n .filter(Boolean)\n .map((className) => className.trim())\n .join(' ');\n};\n","import React from 'react';\nimport './filled.css';\nimport { Data } from '../../../Types/Data';\nimport { clsx } from '../../../utilis/clsx';\nimport { starColors } from '../../../Consts/colors';\n\ninterface Props {\n data: Data[];\n filledColor?: string;\n ratingIconClassname?: string;\n FilledRatingIcon: React.ReactElement;\n width: string;\n}\n\n// eslint-disable-next-line\nfunction FilledStarRating(props: Props) {\n const { data, filledColor = '', ratingIconClassname = '', FilledRatingIcon, width } = props;\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n\n return (\n <div className={'filled'} style={{ width }}>\n {[...Array(numberOfRating)].map((_, i) => (\n <span\n key={`unfilled-star custom icon ${i}`}\n className={clsx('star', ratingIconClassname)}\n style={{\n color: filledColor || starColors.filled\n }}\n >\n {FilledRatingIcon}\n </span>\n ))}\n </div>\n );\n}\n\nexport default FilledStarRating;\n","export const progressBarColors = { filled: '#ffa41c', unfilled: '#f0f2f2' };\nexport const starColors = { filled: '#ffa41c', unfilled: '#ffa41c' };\n","/*eslint-disable*/\nimport React from 'react';\nimport FilledStarRating from '../FilledStarRating';\nimport classes from './Unfilled.module.css';\nimport { Data } from '../../../Types/Data';\nimport { clsx } from '../../../utilis/clsx';\nimport { starColors } from '../../../Consts/colors';\n\ninterface Props {\n data: Data[];\n filledColor?: string;\n unfilledColor?: string;\n ratingIconClassname?: string;\n FilledRatingIcon: React.ReactElement;\n UnfilledRatingIcon: React.ReactElement;\n width: string;\n}\n\nconst StarRating = (props: Props) => {\n const {\n data,\n filledColor,\n unfilledColor,\n ratingIconClassname = '',\n FilledRatingIcon,\n UnfilledRatingIcon,\n width\n } = props;\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n return (\n <div className={classes.unfilled}>\n {[...Array(numberOfRating)].map((_, i) => (\n <span\n key={`unfilled-star custom icon ${i}`}\n // eslint-disable-next-line no-unneeded-ternary\n className={clsx(classes.star, ratingIconClassname)}\n style={{\n // eslint-disable-next-line no-unneeded-ternary\n color: unfilledColor || starColors.unfilled\n }}\n >\n {unfilledColor ? FilledRatingIcon : UnfilledRatingIcon}\n </span>\n ))}\n <FilledStarRating\n data={data}\n filledColor={filledColor}\n ratingIconClassname={ratingIconClassname}\n FilledRatingIcon={FilledRatingIcon}\n width={width}\n />\n </div>\n );\n};\n\nexport default StarRating;\n","import React from 'react';\nimport { AiOutlineStar, AiFillStar } from 'react-icons/ai';\nimport UnfilledStartRating from './UnfilledStarRating';\nimport './starRating.css';\nimport { RatingHeaderType } from '../../Types/RatingHeader';\nimport { clsx } from '../../utilis/clsx';\n\ninterface PercentageObj {\n [key: string]: number;\n}\n\n// eslint-disable-next-line space-before-function-paren\nfunction StarRating(props: RatingHeaderType) {\n const { data, options = {} } = props;\n const {\n filledColor,\n unfilledColor,\n ratingIconClassname,\n show = true,\n className = '',\n FilledRatingIcon = <AiFillStar />,\n UnfilledRatingIcon = <AiOutlineStar />,\n headerText\n } = options;\n\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n const totalCount = data.reduce((acc, obj) => acc + obj.count, 0);\n const per: PercentageObj = {};\n let totalPercentage = 0;\n let starPercentageRounded = '';\n\n data.forEach((rating) => {\n const perOfIndividual = rating.count / totalCount;\n const key = `${rating.rating}`;\n per[key] = perOfIndividual;\n });\n\n for (const x in per) {\n totalPercentage += Number(x) * per[x];\n }\n const percentage = (Number(totalPercentage.toFixed(2)) / numberOfRating) * 100;\n starPercentageRounded = `${percentage}%`;\n return (\n <>\n {show && (\n <div className={'starRating'}>\n <UnfilledStartRating\n data={data}\n filledColor={filledColor}\n unfilledColor={unfilledColor}\n ratingIconClassname={ratingIconClassname}\n FilledRatingIcon={FilledRatingIcon}\n UnfilledRatingIcon={UnfilledRatingIcon}\n width={starPercentageRounded}\n />\n {headerText?.(totalPercentage) || (\n <p className={clsx('rating', className)}>\n {totalPercentage.toFixed(2)} out of {numberOfRating}\n </p>\n )}\n </div>\n )}\n </>\n );\n}\n\nexport default StarRating;\n","import React from 'react';\nimport { progressBarColors } from '../../../Consts/colors';\nimport classes from './progress.module.css';\n\ninterface Props {\n rating: number;\n value: number;\n total: number;\n percentage: number;\n filledColor?: string;\n unfilledColor?: string;\n}\n\n// eslint-disable-next-line space-before-function-paren\nfunction Progress(props: Props) {\n const { percentage, filledColor, unfilledColor } = props;\n\n return (\n <div\n className={classes.progress_bar}\n style={{\n backgroundColor: unfilledColor || progressBarColors.unfilled\n }}\n role=\"progressbar\"\n aria-valuenow={40}\n aria-valuemax={20}\n aria-valuemin={0}\n >\n <div\n className={classes.filled_bar}\n style={{\n width: `${percentage}%`,\n backgroundColor: filledColor || progressBarColors.filled\n }}\n ></div>\n </div>\n );\n}\n\nexport default Progress;\n","import React from 'react';\nimport { ProgressBarProps } from '../../Types/ProgressBar';\nimport { clsx } from '../../utilis/clsx';\nimport Progress from './Progress/Progress';\nimport './progressBar.css';\n\n// eslint-disable-next-line space-before-function-paren\nfunction RatingBars(props: ProgressBarProps) {\n const { data = [], options = {} } = props;\n const { className = '', filledColor, unfilledColor, onClick } = options;\n\n interface InitialGroupedObj {\n [key: number]: number;\n }\n\n const initialGroupedObj: InitialGroupedObj = {};\n\n const groupedData = data.reduce((acc, obj) => {\n if (acc[obj.rating]) {\n return { ...acc, [obj.rating]: acc[obj.rating] + obj.count };\n } else {\n return { ...acc, [obj.rating]: obj.count };\n }\n }, initialGroupedObj);\n\n const maximumRating = Math.max(...data.map((data) => data.rating));\n const possibleRatings = [...Array(maximumRating)].map((_, i) => i + 1);\n\n const addMissedRating: InitialGroupedObj = possibleRatings.reduce((acc, rating) => {\n if (groupedData[rating]) {\n return { ...acc, [rating]: groupedData[rating] };\n } else {\n return { ...acc, [rating]: 0 };\n }\n }, {});\n\n const combinedData = Object.entries(addMissedRating).map(([key, value]) => ({\n count: value,\n rating: Number(key)\n }));\n\n const total = combinedData.reduce(function (acc, obj) {\n return acc + obj.count;\n }, 0);\n\n return (\n <div className={'container'}>\n {combinedData.map((item, index) => {\n const { count, rating } = item;\n const percent = (count * 100) / total || 0;\n\n return (\n <div\n key={index + count}\n className={clsx('inner_container', className)}\n onClick={() => onClick && onClick(item)}\n >\n {options?.progressBarText ? (\n options.progressBarText(item)\n ) : (\n <span className={'subtext'}>{rating}&nbsp;stars</span>\n )}\n\n <Progress\n rating={rating}\n value={count}\n total={total}\n percentage={percent}\n filledColor={filledColor}\n unfilledColor={unfilledColor}\n />\n\n <div>\n {!options?.percentage ? (\n <span className={'percent_text'}>{Math.ceil(percent)} %</span>\n ) : (\n <React.Fragment>{options.percentage(percent, item)} </React.Fragment>\n )}\n </div>\n </div>\n );\n })}\n </div>\n );\n}\n\nexport default RatingBars;\n","import React from 'react';\nimport StarRating from '../Rating/Rating';\nimport './ratings.css';\nimport { RatingsProps } from '../../Types/Ratings';\nimport RatingBars from '../ProgressBar/ProgressBar';\n\nconst Ratings = ({\n data,\n options = {\n progressBar: {},\n rating: {}\n }\n}: RatingsProps) => {\n const { progressBar, rating } = options;\n\n return (\n <div className={'ratings_container'}>\n <StarRating\n data={data}\n options={{\n show: rating?.show,\n filledColor: rating?.filledColor,\n unfilledColor: rating?.unfilledColor,\n ratingIconClassname: rating?.className,\n className: rating?.className,\n FilledRatingIcon: rating?.FilledRatingIcon,\n UnfilledRatingIcon: rating?.UnfilledRatingIcon,\n headerText: rating?.headerText\n }}\n />\n <RatingBars\n data={data}\n options={{\n filledColor: progressBar?.filledColor,\n unfilledColor: progressBar?.unfilledColor,\n className: progressBar?.className,\n percentage: progressBar?.percentage,\n progressBarText: progressBar?.progressBarText,\n onClick: progressBar?.onClick\n }}\n />\n </div>\n );\n};\n\nexport default Ratings;\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","clsx","classes","filter","Boolean","map","className","trim","join","FilledStarRating","props","filledColor","ratingIconClassname","FilledRatingIcon","width","numberOfRating","Math","max","data","rating","React","Array","_","i","key","color","StarRating","unfilledColor","UnfilledRatingIcon","unfilled","star","options","show","AiFillStar","AiOutlineStar","headerText","totalCount","reduce","acc","obj","count","per","totalPercentage","x","forEach","Number","percentage","toFixed","UnfilledStartRating","Progress","backgroundColor","role","RatingBars","onClick","groupedData","maximumRating","addMissedRating","combinedData","Object","entries","total","item","index","percent","progressBarText","value","Fragment","ceil","progressBar"],"mappings":"4KAAA,SAASA,EAAYC,EAAKC,QACX,IAARA,IAAiBA,EAAM,IAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,qSCvBvC,IAAMe,EAAO,sCAAIC,2BAAAA,kBACtB,OAAOA,EACJC,OAAOC,SACPC,KAAI,SAACC,GAAD,OAAeA,EAAUC,UAC7BC,KAAK,MCWV,SAASC,EAAiBC,GACxB,MAAsFA,EAAxEC,YAAAA,aAAc,OAA0DD,EAAtDE,oBAAAA,aAAsB,KAAIC,EAA4BH,EAA5BG,iBAAkBC,EAAUJ,EAAVI,MACtEC,EAAiBC,KAAKC,UAALD,KAD+DN,EAA9EQ,KACgCb,KAAI,SAACa,GAAD,OAAUA,EAAKC,WAE3D,OACEC,uBAAKd,UAAW,SAAUd,MAAO,CAAEs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,yBAAoBT,SAAAA,EAAQS,mBAC5BO,iBAAYhB,SAAAA,EAAQgB,cAGxBf,gBAACgC,GACClC,KAAMA,EACNa,QAAS,CACPpB,kBAAayD,SAAAA,EAAazD,YAC1BgB,oBAAeyC,SAAAA,EAAazC,cAC5BrB,gBAAW8D,SAAAA,EAAa9D,UACxBwC,iBAAYsB,SAAAA,EAAatB,WACzBkB,sBAAiBI,SAAAA,EAAaJ,gBAC9BX,cAASe,SAAAA,EAAaf"}

@@ -31,4 +31,3 @@ import React from 'react';

var css_248z = ".filled-module_filled__7APsd {\n font-size: 3rem;\n position: absolute;\n top: 0;\n left: 0;\n white-space: nowrap;\n overflow: hidden;\n width: 0;\n /* overflow: hidden; */\n}\nspan {\n font-size: 3rem;\n /* overflow: hidden; */\n}\n.filled-module_star__DjRcp {\n font-size: 3rem;\n /* overflow: hidden; */\n}\n";
var classes = {"filled":"filled-module_filled__7APsd","star":"filled-module_star__DjRcp"};
var css_248z = ".filled {\n font-size: 3rem;\n position: absolute;\n top: 0;\n left: 0;\n white-space: nowrap;\n overflow: hidden;\n width: 0;\n /* overflow: hidden; */\n}\nspan {\n font-size: 3rem;\n /* overflow: hidden; */\n}\n.star {\n font-size: 3rem;\n /* overflow: hidden; */\n}\n";
styleInject(css_248z);

@@ -67,3 +66,3 @@

return React.createElement("div", {
className: classes.filled,
className: 'filled',
style: {

@@ -75,3 +74,3 @@ width: width

key: "unfilled-star custom icon " + i,
className: clsx(classes.star, ratingIconClassname),
className: clsx('star', ratingIconClassname),
style: {

@@ -85,3 +84,3 @@ color: filledColor || starColors.filled

var css_248z$1 = ".Unfilled-module_unfilled__2wGJ3 {\n position: relative;\n display: inline-block;\n}\n.Unfilled-module_unfilled__2wGJ3 span {\n font-size: 3rem;\n padding: 0.1rem;\n}\n\n.Unfilled-module_unfilled__2wGJ3 .Unfilled-module_filled__-I2up {\n position: absolute;\n top: 0;\n left: 0;\n white-space: nowrap;\n overflow: hidden;\n width: 0;\n}\n";
var classes$1 = {"unfilled":"Unfilled-module_unfilled__2wGJ3","filled":"Unfilled-module_filled__-I2up"};
var classes = {"unfilled":"Unfilled-module_unfilled__2wGJ3","filled":"Unfilled-module_filled__-I2up"};
styleInject(css_248z$1);

@@ -104,3 +103,3 @@

return React.createElement("div", {
className: classes$1.unfilled
className: classes.unfilled
}, [].concat(Array(numberOfRating)).map(function (_, i) {

@@ -110,3 +109,3 @@ return React.createElement("span", {

// eslint-disable-next-line no-unneeded-ternary
className: clsx(classes$1.star, ratingIconClassname),
className: clsx(classes.star, ratingIconClassname),
style: {

@@ -126,4 +125,3 @@ // eslint-disable-next-line no-unneeded-ternary

var css_248z$2 = ".starRating-module_starRating__8Gp7A {\n display: flex;\n justify-content: center;\n}\n.starRating-module_starRating__8Gp7A .starRating-module_rating__WyRjo {\n font-size: 14px;\n white-space: nowrap;\n margin-left: 1rem;\n}\n";
var classes$2 = {"starRating":"starRating-module_starRating__8Gp7A","rating":"starRating-module_rating__WyRjo"};
var css_248z$2 = ".starRating {\n display: flex;\n justify-content: center;\n}\n.starRating .rating {\n font-size: 14px;\n white-space: nowrap;\n margin-left: 1rem;\n}\n";
styleInject(css_248z$2);

@@ -169,3 +167,3 @@

return React.createElement(React.Fragment, null, show && React.createElement("div", {
className: classes$2.starRating
className: 'starRating'
}, React.createElement(StarRating, {

@@ -180,8 +178,7 @@ data: data,

}), (headerText == null ? void 0 : headerText(totalPercentage)) || React.createElement("p", {
className: clsx(classes$2.rating, className)
className: clsx('rating', className)
}, totalPercentage.toFixed(2), " out of ", numberOfRating)));
}
var css_248z$3 = ".ratings-module_container__3oVdJ {\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n justify-content: center;\n background-color: #fff;\n}\n";
var classes$3 = {"container":"ratings-module_container__3oVdJ"};
var css_248z$3 = ".ratings_container {\n display: flex;\n flex-direction: column;\n align-items: center;\n width: 100%;\n justify-content: center;\n background-color: #fff;\n}\n";
styleInject(css_248z$3);

@@ -208,3 +205,3 @@

var css_248z$4 = ".progress-module_progress_bar__QisS6 {\n display: flex;\n flex: 1;\n align-self: stretch;\n border-radius: 4px;\n}\n\n.progress-module_filled_bar__gDcZy {\n border-radius: 4px 0 0 4px;\n height: 100%;\n}\n";
var classes$4 = {"progress_bar":"progress-module_progress_bar__QisS6","filled_bar":"progress-module_filled_bar__gDcZy"};
var classes$1 = {"progress_bar":"progress-module_progress_bar__QisS6","filled_bar":"progress-module_filled_bar__gDcZy"};
styleInject(css_248z$4);

@@ -217,3 +214,3 @@

return React.createElement("div", {
className: classes$4.progress_bar,
className: classes$1.progress_bar,
style: {

@@ -227,3 +224,3 @@ backgroundColor: unfilledColor || progressBarColors.unfilled

}, React.createElement("div", {
className: classes$4.filled_bar,
className: classes$1.filled_bar,
style: {

@@ -236,4 +233,3 @@ width: percentage + "%",

var css_248z$5 = ".progressBar-module_container__cq1Qv {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 1.2rem;\n box-sizing: border-box;\n padding: 10px;\n}\n\n.progressBar-module_inner_container__Ig-ty {\n width: 100%;\n height: 1.2rem;\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 0.8rem;\n}\n\n.progressBar-module_subtext__bfp0o {\n font-size: 14px;\n white-space: nowrap;\n display: flex;\n}\n\n.progressBar-module_percent_text__h5xUT {\n font-size: 14px;\n white-space: nowrap;\n display: flex;\n width: 35px;\n justify-content: flex-end;\n}\n";
var classes$5 = {"container":"progressBar-module_container__cq1Qv","inner_container":"progressBar-module_inner_container__Ig-ty","subtext":"progressBar-module_subtext__bfp0o","percent_text":"progressBar-module_percent_text__h5xUT"};
var css_248z$5 = ".container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 1.2rem;\n box-sizing: border-box;\n padding: 10px;\n}\n\n.inner_container {\n width: 100%;\n height: 1.2rem;\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 0.8rem;\n}\n\n.subtext {\n font-size: 14px;\n white-space: nowrap;\n display: flex;\n}\n\n.percent_text {\n font-size: 14px;\n white-space: nowrap;\n display: flex;\n width: 35px;\n justify-content: flex-end;\n}\n";
styleInject(css_248z$5);

@@ -292,3 +288,3 @@

return React.createElement("div", {
className: classes$5.container
className: 'container'
}, combinedData.map(function (item, index) {

@@ -300,3 +296,3 @@ var count = item.count,

key: index + count,
className: clsx(classes$5.inner_container, className),
className: clsx('inner_container', className),
onClick: function onClick() {

@@ -306,3 +302,3 @@ return _onClick && _onClick(item);

}, options != null && options.progressBarText ? options.progressBarText(item) : React.createElement("span", {
className: classes$5.subtext
className: 'subtext'
}, rating, "\xA0stars"), React.createElement(Progress, {

@@ -316,3 +312,3 @@ rating: rating,

}), React.createElement("div", null, !(options != null && options.percentage) ? React.createElement("span", {
className: classes$5.percent_text
className: 'percent_text'
}, Math.ceil(percent), " %") : React.createElement(React.Fragment, null, options.percentage(percent, item), " ")));

@@ -332,3 +328,3 @@ }));

return React.createElement("div", {
className: classes$3.container
className: 'ratings_container'
}, React.createElement(StarRating$1, {

@@ -335,0 +331,0 @@ data: data,

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

{"version":3,"file":"react-custom-ratings.esm.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/utilis/clsx.tsx","../src/Consts/colors.ts","../src/components/Rating/FilledStarRating/index.tsx","../src/components/Rating/UnfilledStarRating/index.tsx","../src/components/Rating/Rating.tsx","../src/components/ProgressBar/Progress/Progress.tsx","../src/components/ProgressBar/ProgressBar.tsx","../src/components/Ratings/Ratings.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","export const clsx = (...classes: string[]) => {\n return classes\n .filter(Boolean)\n .map((className) => className.trim())\n .join(' ');\n};\n","export const progressBarColors = { filled: '#ffa41c', unfilled: '#f0f2f2' };\nexport const starColors = { filled: '#ffa41c', unfilled: '#ffa41c' };\n","import React from 'react';\nimport classes from './filled.module.css';\nimport { Data } from '../../../Types/Data';\nimport { clsx } from '../../../utilis/clsx';\nimport { starColors } from '../../../Consts/colors';\n\ninterface Props {\n data: Data[];\n filledColor?: string;\n ratingIconClassname?: string;\n FilledRatingIcon: React.ReactElement;\n width: string;\n}\n\n// eslint-disable-next-line\nfunction FilledStarRating(props: Props) {\n const { data, filledColor = '', ratingIconClassname = '', FilledRatingIcon, width } = props;\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n\n return (\n <div className={classes.filled} style={{ width }}>\n {[...Array(numberOfRating)].map((_, i) => (\n <span\n key={`unfilled-star custom icon ${i}`}\n className={clsx(classes.star, ratingIconClassname)}\n style={{\n color: filledColor || starColors.filled\n }}\n >\n {FilledRatingIcon}\n </span>\n ))}\n </div>\n );\n}\n\nexport default FilledStarRating;\n","/*eslint-disable*/\nimport React from 'react';\nimport FilledStarRating from '../FilledStarRating';\nimport classes from './Unfilled.module.css';\nimport { Data } from '../../../Types/Data';\nimport { clsx } from '../../../utilis/clsx';\nimport { starColors } from '../../../Consts/colors';\n\ninterface Props {\n data: Data[];\n filledColor?: string;\n unfilledColor?: string;\n ratingIconClassname?: string;\n FilledRatingIcon: React.ReactElement;\n UnfilledRatingIcon: React.ReactElement;\n width: string;\n}\n\nconst StarRating = (props: Props) => {\n const {\n data,\n filledColor,\n unfilledColor,\n ratingIconClassname = '',\n FilledRatingIcon,\n UnfilledRatingIcon,\n width\n } = props;\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n return (\n <div className={classes.unfilled}>\n {[...Array(numberOfRating)].map((_, i) => (\n <span\n key={`unfilled-star custom icon ${i}`}\n // eslint-disable-next-line no-unneeded-ternary\n className={clsx(classes.star, ratingIconClassname)}\n style={{\n // eslint-disable-next-line no-unneeded-ternary\n color: unfilledColor || starColors.unfilled\n }}\n >\n {unfilledColor ? FilledRatingIcon : UnfilledRatingIcon}\n </span>\n ))}\n <FilledStarRating\n data={data}\n filledColor={filledColor}\n ratingIconClassname={ratingIconClassname}\n FilledRatingIcon={FilledRatingIcon}\n width={width}\n />\n </div>\n );\n};\n\nexport default StarRating;\n","import React from 'react';\nimport { AiOutlineStar, AiFillStar } from 'react-icons/ai';\nimport UnfilledStartRating from './UnfilledStarRating';\nimport classes from './starRating.module.css';\nimport { RatingHeaderType } from '../../Types/RatingHeader';\nimport { clsx } from '../../utilis/clsx';\n\ninterface PercentageObj {\n [key: string]: number;\n}\n\n// eslint-disable-next-line space-before-function-paren\nfunction StarRating(props: RatingHeaderType) {\n const { data, options = {} } = props;\n const {\n filledColor,\n unfilledColor,\n ratingIconClassname,\n show = true,\n className = '',\n FilledRatingIcon = <AiFillStar />,\n UnfilledRatingIcon = <AiOutlineStar />,\n headerText\n } = options;\n\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n const totalCount = data.reduce((acc, obj) => acc + obj.count, 0);\n const per: PercentageObj = {};\n let totalPercentage = 0;\n let starPercentageRounded = '';\n\n data.forEach((rating) => {\n const perOfIndividual = rating.count / totalCount;\n const key = `${rating.rating}`;\n per[key] = perOfIndividual;\n });\n\n for (const x in per) {\n totalPercentage += Number(x) * per[x];\n }\n const percentage = (Number(totalPercentage.toFixed(2)) / numberOfRating) * 100;\n starPercentageRounded = `${percentage}%`;\n return (\n <>\n {show && (\n <div className={classes.starRating}>\n <UnfilledStartRating\n data={data}\n filledColor={filledColor}\n unfilledColor={unfilledColor}\n ratingIconClassname={ratingIconClassname}\n FilledRatingIcon={FilledRatingIcon}\n UnfilledRatingIcon={UnfilledRatingIcon}\n width={starPercentageRounded}\n />\n {headerText?.(totalPercentage) || (\n <p className={clsx(classes.rating, className)}>\n {totalPercentage.toFixed(2)} out of {numberOfRating}\n </p>\n )}\n </div>\n )}\n </>\n );\n}\n\nexport default StarRating;\n","import React from 'react';\nimport { progressBarColors } from '../../../Consts/colors';\nimport classes from './progress.module.css';\n\ninterface Props {\n rating: number;\n value: number;\n total: number;\n percentage: number;\n filledColor?: string;\n unfilledColor?: string;\n}\n\n// eslint-disable-next-line space-before-function-paren\nfunction Progress(props: Props) {\n const { percentage, filledColor, unfilledColor } = props;\n\n return (\n <div\n className={classes.progress_bar}\n style={{\n backgroundColor: unfilledColor || progressBarColors.unfilled\n }}\n role=\"progressbar\"\n aria-valuenow={40}\n aria-valuemax={20}\n aria-valuemin={0}\n >\n <div\n className={classes.filled_bar}\n style={{\n width: `${percentage}%`,\n backgroundColor: filledColor || progressBarColors.filled\n }}\n ></div>\n </div>\n );\n}\n\nexport default Progress;\n","import React from 'react';\nimport { ProgressBarProps } from '../../Types/ProgressBar';\nimport { clsx } from '../../utilis/clsx';\nimport Progress from './Progress/Progress';\nimport classes from './progressBar.module.css';\n\n// eslint-disable-next-line space-before-function-paren\nfunction RatingBars(props: ProgressBarProps) {\n const { data = [], options = {} } = props;\n const { className = '', filledColor, unfilledColor, onClick } = options;\n\n interface InitialGroupedObj {\n [key: number]: number;\n }\n\n const initialGroupedObj: InitialGroupedObj = {};\n\n const groupedData = data.reduce((acc, obj) => {\n if (acc[obj.rating]) {\n return { ...acc, [obj.rating]: acc[obj.rating] + obj.count };\n } else {\n return { ...acc, [obj.rating]: obj.count };\n }\n }, initialGroupedObj);\n\n const maximumRating = Math.max(...data.map((data) => data.rating));\n const possibleRatings = [...Array(maximumRating)].map((_, i) => i + 1);\n\n const addMissedRating: InitialGroupedObj = possibleRatings.reduce((acc, rating) => {\n if (groupedData[rating]) {\n return { ...acc, [rating]: groupedData[rating] };\n } else {\n return { ...acc, [rating]: 0 };\n }\n }, {});\n\n const combinedData = Object.entries(addMissedRating).map(([key, value]) => ({\n count: value,\n rating: Number(key)\n }));\n\n const total = combinedData.reduce(function (acc, obj) {\n return acc + obj.count;\n }, 0);\n\n return (\n <div className={classes.container}>\n {combinedData.map((item, index) => {\n const { count, rating } = item;\n const percent = (count * 100) / total || 0;\n\n return (\n <div\n key={index + count}\n className={clsx(classes.inner_container, className)}\n onClick={() => onClick && onClick(item)}>\n {options?.progressBarText ? (\n options.progressBarText(item)\n ) : (\n <span className={classes.subtext}>{rating}&nbsp;stars</span>\n )}\n\n <Progress\n rating={rating}\n value={count}\n total={total}\n percentage={percent}\n filledColor={filledColor}\n unfilledColor={unfilledColor}\n />\n\n <div>\n {!options?.percentage ? (\n <span className={classes.percent_text}>{Math.ceil(percent)} %</span>\n ) : (\n <React.Fragment>{options.percentage(percent, item)} </React.Fragment>\n )}\n </div>\n </div>\n );\n })}\n </div>\n );\n}\n\nexport default RatingBars;\n","import React from 'react';\nimport StarRating from '../Rating/Rating';\nimport classes from './ratings.module.css';\nimport { RatingsProps } from '../../Types/Ratings';\nimport RatingBars from '../ProgressBar/ProgressBar';\n\nconst Ratings = ({\n data,\n options = {\n progressBar: {},\n rating: {}\n }\n}: RatingsProps) => {\n const { progressBar, rating } = options;\n\n return (\n <div className={classes.container}>\n <StarRating\n data={data}\n options={{\n show: rating?.show,\n filledColor: rating?.filledColor,\n unfilledColor: rating?.unfilledColor,\n ratingIconClassname: rating?.className,\n className: rating?.className,\n FilledRatingIcon: rating?.FilledRatingIcon,\n UnfilledRatingIcon: rating?.UnfilledRatingIcon,\n headerText: rating?.headerText\n }}\n />\n <RatingBars\n data={data}\n options={{\n filledColor: progressBar?.filledColor,\n unfilledColor: progressBar?.unfilledColor,\n className: progressBar?.className,\n percentage: progressBar?.percentage,\n progressBarText: progressBar?.progressBarText,\n onClick: progressBar?.onClick\n }}\n />\n </div>\n );\n};\n\nexport default Ratings;\n"],"names":["clsx","classes","filter","Boolean","map","className","trim","join","progressBarColors","filled","unfilled","starColors","FilledStarRating","props","data","filledColor","ratingIconClassname","FilledRatingIcon","width","numberOfRating","Math","max","rating","React","style","Array","_","i","key","star","color","StarRating","unfilledColor","UnfilledRatingIcon","options","show","AiFillStar","AiOutlineStar","headerText","totalCount","reduce","acc","obj","count","per","totalPercentage","starPercentageRounded","forEach","perOfIndividual","x","Number","percentage","toFixed","starRating","UnfilledStartRating","Progress","progress_bar","backgroundColor","role","filled_bar","RatingBars","onClick","initialGroupedObj","groupedData","maximumRating","possibleRatings","addMissedRating","combinedData","Object","entries","value","total","container","item","index","percent","inner_container","progressBarText","subtext","percent_text","ceil","Fragment","Ratings","progressBar"],"mappings":";;;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;AACjC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AAC9B;AACA,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,EAAE;AAC1D;AACA,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC9C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1B;AACA,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAChD,KAAK,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC9B,KAAK;AACL,GAAG,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,GAAG;AACH;AACA,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE;A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EAAEO,MAAF,oBAAEA,MAAM,CAAEP,WAFd;MAGPiB,aAAa,EAAEV,MAAF,oBAAEA,MAAM,CAAEU,aAHhB;MAIPhB,mBAAmB,EAAEM,MAAF,oBAAEA,MAAM,CAAEjB,SAJtB;MAKPA,SAAS,EAAEiB,MAAF,oBAAEA,MAAM,CAAEjB,SALZ;MAMPY,gBAAgB,EAAEK,MAAF,oBAAEA,MAAM,CAAEL,gBANnB;MAOPgB,kBAAkB,EAAEX,MAAF,oBAAEA,MAAM,CAAEW,kBAPrB;MAQPK,UAAU,EAAEhB,MAAF,oBAAEA,MAAM,CAAEgB;;GAVxB,CADF,EAcEf,mBAAA,CAACqC,UAAD;IACE9C,IAAI,EAAEA;IACNoB,OAAO,EAAE;MACPnB,WAAW,EAAEoE,WAAF,oBAAEA,WAAW,CAAEpE,WADnB;MAEPiB,aAAa,EAAEmD,WAAF,oBAAEA,WAAW,CAAEnD,aAFrB;MAGP3B,SAAS,EAAE8E,WAAF,oBAAEA,WAAW,CAAE9E,SAHjB;MAIP8C,UAAU,EAAEgC,WAAF,oBAAEA,WAAW,CAAEhC,UAJlB;MAKP0B,eAAe,EAAEM,WAAF,oBAAEA,WAAW,CAAEN,eALvB;MAMPhB,OAAO,EAAEsB,WAAF,oBAAEA,WAAW,CAAEtB;;GAR1B,CAdF,CADF;AA4BD,CArCD;;;;"}
{"version":3,"file":"react-custom-ratings.esm.js","sources":["../node_modules/style-inject/dist/style-inject.es.js","../src/utilis/clsx.tsx","../src/Consts/colors.ts","../src/components/Rating/FilledStarRating/index.tsx","../src/components/Rating/UnfilledStarRating/index.tsx","../src/components/Rating/Rating.tsx","../src/components/ProgressBar/Progress/Progress.tsx","../src/components/ProgressBar/ProgressBar.tsx","../src/components/Ratings/Ratings.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","export const clsx = (...classes: string[]) => {\n return classes\n .filter(Boolean)\n .map((className) => className.trim())\n .join(' ');\n};\n","export const progressBarColors = { filled: '#ffa41c', unfilled: '#f0f2f2' };\nexport const starColors = { filled: '#ffa41c', unfilled: '#ffa41c' };\n","import React from 'react';\nimport './filled.css';\nimport { Data } from '../../../Types/Data';\nimport { clsx } from '../../../utilis/clsx';\nimport { starColors } from '../../../Consts/colors';\n\ninterface Props {\n data: Data[];\n filledColor?: string;\n ratingIconClassname?: string;\n FilledRatingIcon: React.ReactElement;\n width: string;\n}\n\n// eslint-disable-next-line\nfunction FilledStarRating(props: Props) {\n const { data, filledColor = '', ratingIconClassname = '', FilledRatingIcon, width } = props;\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n\n return (\n <div className={'filled'} style={{ width }}>\n {[...Array(numberOfRating)].map((_, i) => (\n <span\n key={`unfilled-star custom icon ${i}`}\n className={clsx('star', ratingIconClassname)}\n style={{\n color: filledColor || starColors.filled\n }}\n >\n {FilledRatingIcon}\n </span>\n ))}\n </div>\n );\n}\n\nexport default FilledStarRating;\n","/*eslint-disable*/\nimport React from 'react';\nimport FilledStarRating from '../FilledStarRating';\nimport classes from './Unfilled.module.css';\nimport { Data } from '../../../Types/Data';\nimport { clsx } from '../../../utilis/clsx';\nimport { starColors } from '../../../Consts/colors';\n\ninterface Props {\n data: Data[];\n filledColor?: string;\n unfilledColor?: string;\n ratingIconClassname?: string;\n FilledRatingIcon: React.ReactElement;\n UnfilledRatingIcon: React.ReactElement;\n width: string;\n}\n\nconst StarRating = (props: Props) => {\n const {\n data,\n filledColor,\n unfilledColor,\n ratingIconClassname = '',\n FilledRatingIcon,\n UnfilledRatingIcon,\n width\n } = props;\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n return (\n <div className={classes.unfilled}>\n {[...Array(numberOfRating)].map((_, i) => (\n <span\n key={`unfilled-star custom icon ${i}`}\n // eslint-disable-next-line no-unneeded-ternary\n className={clsx(classes.star, ratingIconClassname)}\n style={{\n // eslint-disable-next-line no-unneeded-ternary\n color: unfilledColor || starColors.unfilled\n }}\n >\n {unfilledColor ? FilledRatingIcon : UnfilledRatingIcon}\n </span>\n ))}\n <FilledStarRating\n data={data}\n filledColor={filledColor}\n ratingIconClassname={ratingIconClassname}\n FilledRatingIcon={FilledRatingIcon}\n width={width}\n />\n </div>\n );\n};\n\nexport default StarRating;\n","import React from 'react';\nimport { AiOutlineStar, AiFillStar } from 'react-icons/ai';\nimport UnfilledStartRating from './UnfilledStarRating';\nimport './starRating.css';\nimport { RatingHeaderType } from '../../Types/RatingHeader';\nimport { clsx } from '../../utilis/clsx';\n\ninterface PercentageObj {\n [key: string]: number;\n}\n\n// eslint-disable-next-line space-before-function-paren\nfunction StarRating(props: RatingHeaderType) {\n const { data, options = {} } = props;\n const {\n filledColor,\n unfilledColor,\n ratingIconClassname,\n show = true,\n className = '',\n FilledRatingIcon = <AiFillStar />,\n UnfilledRatingIcon = <AiOutlineStar />,\n headerText\n } = options;\n\n const numberOfRating = Math.max(...data.map((data) => data.rating));\n const totalCount = data.reduce((acc, obj) => acc + obj.count, 0);\n const per: PercentageObj = {};\n let totalPercentage = 0;\n let starPercentageRounded = '';\n\n data.forEach((rating) => {\n const perOfIndividual = rating.count / totalCount;\n const key = `${rating.rating}`;\n per[key] = perOfIndividual;\n });\n\n for (const x in per) {\n totalPercentage += Number(x) * per[x];\n }\n const percentage = (Number(totalPercentage.toFixed(2)) / numberOfRating) * 100;\n starPercentageRounded = `${percentage}%`;\n return (\n <>\n {show && (\n <div className={'starRating'}>\n <UnfilledStartRating\n data={data}\n filledColor={filledColor}\n unfilledColor={unfilledColor}\n ratingIconClassname={ratingIconClassname}\n FilledRatingIcon={FilledRatingIcon}\n UnfilledRatingIcon={UnfilledRatingIcon}\n width={starPercentageRounded}\n />\n {headerText?.(totalPercentage) || (\n <p className={clsx('rating', className)}>\n {totalPercentage.toFixed(2)} out of {numberOfRating}\n </p>\n )}\n </div>\n )}\n </>\n );\n}\n\nexport default StarRating;\n","import React from 'react';\nimport { progressBarColors } from '../../../Consts/colors';\nimport classes from './progress.module.css';\n\ninterface Props {\n rating: number;\n value: number;\n total: number;\n percentage: number;\n filledColor?: string;\n unfilledColor?: string;\n}\n\n// eslint-disable-next-line space-before-function-paren\nfunction Progress(props: Props) {\n const { percentage, filledColor, unfilledColor } = props;\n\n return (\n <div\n className={classes.progress_bar}\n style={{\n backgroundColor: unfilledColor || progressBarColors.unfilled\n }}\n role=\"progressbar\"\n aria-valuenow={40}\n aria-valuemax={20}\n aria-valuemin={0}\n >\n <div\n className={classes.filled_bar}\n style={{\n width: `${percentage}%`,\n backgroundColor: filledColor || progressBarColors.filled\n }}\n ></div>\n </div>\n );\n}\n\nexport default Progress;\n","import React from 'react';\nimport { ProgressBarProps } from '../../Types/ProgressBar';\nimport { clsx } from '../../utilis/clsx';\nimport Progress from './Progress/Progress';\nimport './progressBar.css';\n\n// eslint-disable-next-line space-before-function-paren\nfunction RatingBars(props: ProgressBarProps) {\n const { data = [], options = {} } = props;\n const { className = '', filledColor, unfilledColor, onClick } = options;\n\n interface InitialGroupedObj {\n [key: number]: number;\n }\n\n const initialGroupedObj: InitialGroupedObj = {};\n\n const groupedData = data.reduce((acc, obj) => {\n if (acc[obj.rating]) {\n return { ...acc, [obj.rating]: acc[obj.rating] + obj.count };\n } else {\n return { ...acc, [obj.rating]: obj.count };\n }\n }, initialGroupedObj);\n\n const maximumRating = Math.max(...data.map((data) => data.rating));\n const possibleRatings = [...Array(maximumRating)].map((_, i) => i + 1);\n\n const addMissedRating: InitialGroupedObj = possibleRatings.reduce((acc, rating) => {\n if (groupedData[rating]) {\n return { ...acc, [rating]: groupedData[rating] };\n } else {\n return { ...acc, [rating]: 0 };\n }\n }, {});\n\n const combinedData = Object.entries(addMissedRating).map(([key, value]) => ({\n count: value,\n rating: Number(key)\n }));\n\n const total = combinedData.reduce(function (acc, obj) {\n return acc + obj.count;\n }, 0);\n\n return (\n <div className={'container'}>\n {combinedData.map((item, index) => {\n const { count, rating } = item;\n const percent = (count * 100) / total || 0;\n\n return (\n <div\n key={index + count}\n className={clsx('inner_container', className)}\n onClick={() => onClick && onClick(item)}\n >\n {options?.progressBarText ? (\n options.progressBarText(item)\n ) : (\n <span className={'subtext'}>{rating}&nbsp;stars</span>\n )}\n\n <Progress\n rating={rating}\n value={count}\n total={total}\n percentage={percent}\n filledColor={filledColor}\n unfilledColor={unfilledColor}\n />\n\n <div>\n {!options?.percentage ? (\n <span className={'percent_text'}>{Math.ceil(percent)} %</span>\n ) : (\n <React.Fragment>{options.percentage(percent, item)} </React.Fragment>\n )}\n </div>\n </div>\n );\n })}\n </div>\n );\n}\n\nexport default RatingBars;\n","import React from 'react';\nimport StarRating from '../Rating/Rating';\nimport './ratings.css';\nimport { RatingsProps } from '../../Types/Ratings';\nimport RatingBars from '../ProgressBar/ProgressBar';\n\nconst Ratings = ({\n data,\n options = {\n progressBar: {},\n rating: {}\n }\n}: RatingsProps) => {\n const { progressBar, rating } = options;\n\n return (\n <div className={'ratings_container'}>\n <StarRating\n data={data}\n options={{\n show: rating?.show,\n filledColor: rating?.filledColor,\n unfilledColor: rating?.unfilledColor,\n ratingIconClassname: rating?.className,\n className: rating?.className,\n FilledRatingIcon: rating?.FilledRatingIcon,\n UnfilledRatingIcon: rating?.UnfilledRatingIcon,\n headerText: rating?.headerText\n }}\n />\n <RatingBars\n data={data}\n options={{\n filledColor: progressBar?.filledColor,\n unfilledColor: progressBar?.unfilledColor,\n className: progressBar?.className,\n percentage: progressBar?.percentage,\n progressBarText: progressBar?.progressBarText,\n onClick: progressBar?.onClick\n }}\n />\n </div>\n );\n};\n\nexport default Ratings;\n"],"names":["clsx","classes","filter","Boolean","map","className","trim","join","progressBarColors","filled","unfilled","starColors","FilledStarRating","props","data","filledColor","ratingIconClassname","FilledRatingIcon","width","numberOfRating","Math","max","rating","React","style","Array","_","i","key","color","StarRating","unfilledColor","UnfilledRatingIcon","star","options","show","AiFillStar","AiOutlineStar","headerText","totalCount","reduce","acc","obj","count","per","totalPercentage","starPercentageRounded","forEach","perOfIndividual","x","Number","percentage","toFixed","UnfilledStartRating","Progress","progress_bar","backgroundColor","role","filled_bar","RatingBars","onClick","initialGroupedObj","groupedData","maximumRating","possibleRatings","addMissedRating","combinedData","Object","entries","value","total","item","index","percent","progressBarText","ceil","Fragment","Ratings","progressBar"],"mappings":";;;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;AACjC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AAC9B;AACA,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,EAAE;AAC1D;AACA,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC9C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1B;AACA,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAChD,KAAK,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC9B,KAAK;AACL,GAAG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GPgB,aAAa,EAAET,MAAF,oBAAEA,MAAM,CAAES,aAHhB;MAIPf,mBAAmB,EAAEM,MAAF,oBAAEA,MAAM,CAAEjB,SAJtB;MAKPA,SAAS,EAAEiB,MAAF,oBAAEA,MAAM,CAAEjB,SALZ;MAMPY,gBAAgB,EAAEK,MAAF,oBAAEA,MAAM,CAAEL,gBANnB;MAOPe,kBAAkB,EAAEV,MAAF,oBAAEA,MAAM,CAAEU,kBAPrB;MAQPM,UAAU,EAAEhB,MAAF,oBAAEA,MAAM,CAAEgB;;GAVxB,CADF,EAcEf,mBAAA,CAACoC,UAAD;IACE7C,IAAI,EAAEA;IACNoB,OAAO,EAAE;MACPnB,WAAW,EAAE+D,WAAF,oBAAEA,WAAW,CAAE/D,WADnB;MAEPgB,aAAa,EAAE+C,WAAF,oBAAEA,WAAW,CAAE/C,aAFrB;MAGP1B,SAAS,EAAEyE,WAAF,oBAAEA,WAAW,CAAEzE,SAHjB;MAIP8C,UAAU,EAAE2B,WAAF,oBAAEA,WAAW,CAAE3B,UAJlB;MAKPuB,eAAe,EAAEI,WAAF,oBAAEA,WAAW,CAAEJ,eALvB;MAMPd,OAAO,EAAEkB,WAAF,oBAAEA,WAAW,CAAElB;;GAR1B,CAdF,CADF;AA4BD,CArCD;;;;"}
{
"version": "0.1.1",
"version": "0.1.2",
"license": "MIT",

@@ -4,0 +4,0 @@ "main": "dist/index.js",

@@ -5,3 +5,3 @@ import React from 'react';

import Progress from './Progress/Progress';
import classes from './progressBar.module.css';
import './progressBar.css';

@@ -48,3 +48,3 @@ // eslint-disable-next-line space-before-function-paren

return (
<div className={classes.container}>
<div className={'container'}>
{combinedData.map((item, index) => {

@@ -57,8 +57,9 @@ const { count, rating } = item;

key={index + count}
className={clsx(classes.inner_container, className)}
onClick={() => onClick && onClick(item)}>
className={clsx('inner_container', className)}
onClick={() => onClick && onClick(item)}
>
{options?.progressBarText ? (
options.progressBarText(item)
) : (
<span className={classes.subtext}>{rating}&nbsp;stars</span>
<span className={'subtext'}>{rating}&nbsp;stars</span>
)}

@@ -77,3 +78,3 @@

{!options?.percentage ? (
<span className={classes.percent_text}>{Math.ceil(percent)} %</span>
<span className={'percent_text'}>{Math.ceil(percent)} %</span>
) : (

@@ -80,0 +81,0 @@ <React.Fragment>{options.percentage(percent, item)} </React.Fragment>

import React from 'react';
import classes from './filled.module.css';
import './filled.css';
import { Data } from '../../../Types/Data';

@@ -21,7 +21,7 @@ import { clsx } from '../../../utilis/clsx';

return (
<div className={classes.filled} style={{ width }}>
<div className={'filled'} style={{ width }}>
{[...Array(numberOfRating)].map((_, i) => (
<span
key={`unfilled-star custom icon ${i}`}
className={clsx(classes.star, ratingIconClassname)}
className={clsx('star', ratingIconClassname)}
style={{

@@ -28,0 +28,0 @@ color: filledColor || starColors.filled

import React from 'react';
import { AiOutlineStar, AiFillStar } from 'react-icons/ai';
import UnfilledStartRating from './UnfilledStarRating';
import classes from './starRating.module.css';
import './starRating.css';
import { RatingHeaderType } from '../../Types/RatingHeader';

@@ -46,3 +46,3 @@ import { clsx } from '../../utilis/clsx';

{show && (
<div className={classes.starRating}>
<div className={'starRating'}>
<UnfilledStartRating

@@ -58,3 +58,3 @@ data={data}

{headerText?.(totalPercentage) || (
<p className={clsx(classes.rating, className)}>
<p className={clsx('rating', className)}>
{totalPercentage.toFixed(2)} out of {numberOfRating}

@@ -61,0 +61,0 @@ </p>

import React from 'react';
import StarRating from '../Rating/Rating';
import classes from './ratings.module.css';
import './ratings.css';
import { RatingsProps } from '../../Types/Ratings';

@@ -17,3 +17,3 @@ import RatingBars from '../ProgressBar/ProgressBar';

return (
<div className={classes.container}>
<div className={'ratings_container'}>
<StarRating

@@ -20,0 +20,0 @@ data={data}

.container {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
gap: 1.2rem;
box-sizing: border-box;
padding: 10px;
}
.inner_container {
width: 100%;
height: 1.2rem;
display: flex;
flex-direction: row;
align-items: center;
gap: 0.8rem;
}
.subtext {
font-size: 14px;
white-space: nowrap;
display: flex;
}
.percent_text {
font-size: 14px;
white-space: nowrap;
display: flex;
width: 35px;
justify-content: flex-end;
}
.filled {
font-size: 3rem;
position: absolute;
top: 0;
left: 0;
white-space: nowrap;
overflow: hidden;
width: 0;
/* overflow: hidden; */
}
span {
font-size: 3rem;
/* overflow: hidden; */
}
.star {
font-size: 3rem;
/* overflow: hidden; */
}
.starRating {
display: flex;
justify-content: center;
}
.starRating .rating {
font-size: 14px;
white-space: nowrap;
margin-left: 1rem;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
justify-content: center;
background-color: #fff;
}