{"_id":"@aniruddha1806/rating","_rev":"3-42e8291e46ba56dad5a66d95dc315bcd","name":"@aniruddha1806/rating","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@aniruddha1806/rating","version":"1.0.0","keywords":["react","rating","component","stars","feedback"],"author":{"name":"Your Name"},"license":"MIT","_id":"@aniruddha1806/rating@1.0.0","maintainers":[{"name":"aniruddha1806","email":"aniruddha.kulkarni1806@gmail.com"}],"dist":{"shasum":"588b170cd2edda017d81513ac3779cfebba4c8d6","tarball":"https://registry.npmjs.org/@aniruddha1806/rating/-/rating-1.0.0.tgz","fileCount":12,"integrity":"sha512-sVelTdABOEDbFmV0T/8riMLUzKZit5ILMWryABwRkBJ+LvvnUqBadNTDRsBz3GJn96NgJ3b59Kig2q4hyDHMYA==","signatures":[{"sig":"MEUCIFj3ZcP2BX9lJ6Wc9pSvwwtq6NnN3CwA+xcSe1owz0+/AiEAkMPZSPJ9PEClUT5mjXqIeXZO2UZGGmyfzUMhjMgVaps=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":61826},"main":"dist/cjs/index.js","types":"dist/index.d.ts","module":"dist/esm/index.js","scripts":{"build":"rollup -c","clean":"rimraf dist","prebuild":"npm run clean","prepublishOnly":"npm run build"},"_npmUser":{"name":"aniruddha1806","email":"aniruddha.kulkarni1806@gmail.com"},"_npmVersion":"10.9.1","description":"A customizable rating component for React","directories":{},"_nodeVersion":"20.14.0","_hasShrinkwrap":false,"devDependencies":{"react":"^18.0.0","tslib":"^2.4.0","rimraf":"^3.0.2","rollup":"^2.75.0","react-dom":"^18.0.0","typescript":"^4.7.2","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","rollup-plugin-dts":"^4.2.2","rollup-plugin-terser":"^7.0.2","@rollup/plugin-commonjs":"^22.0.0","@rollup/plugin-typescript":"^8.3.2","@rollup/plugin-node-resolve":"^13.3.0","rollup-plugin-peer-deps-external":"^2.2.4"},"peerDependencies":{"react":">=16.8.0","react-dom":">=16.8.0"},"_npmOperationalInternal":{"tmp":"tmp/rating_1.0.0_1743776847763_0.04831918294477333","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@aniruddha1806/rating","version":"1.0.1","keywords":["react","rating","component","stars","feedback"],"author":{"name":"Your Name"},"license":"MIT","_id":"@aniruddha1806/rating@1.0.1","maintainers":[{"name":"aniruddha1806","email":"aniruddha.kulkarni1806@gmail.com"}],"dist":{"shasum":"7df7f158de7d01b104247724dc06cf6845737a28","tarball":"https://registry.npmjs.org/@aniruddha1806/rating/-/rating-1.0.1.tgz","fileCount":13,"integrity":"sha512-FJbmuCYpD65U1b/RVrSX4dTEnJBZSptb9K4BDIv42+nayRSqiY/aGXkkZy1xo/EwNpFVhHlYV4h4mSzUMZ8oLg==","signatures":[{"sig":"MEQCIGsyVLNrhbspP9k+URYWQj/39uhp5wZMmQDg/LVUAA5bAiA2IpMHEWtuSxMLJjPFyAtZsch8US9hF1sOaycKtd8JQw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":68704},"main":"dist/cjs/index.js","types":"dist/index.d.ts","module":"dist/esm/index.js","scripts":{"build":"rollup -c","clean":"rimraf dist","prebuild":"npm run clean","prepublishOnly":"npm run build"},"_npmUser":{"name":"aniruddha1806","email":"aniruddha.kulkarni1806@gmail.com"},"_npmVersion":"10.9.1","description":"A customizable rating component for React","directories":{},"_nodeVersion":"20.14.0","_hasShrinkwrap":false,"devDependencies":{"react":"^18.0.0","tslib":"^2.4.0","rimraf":"^3.0.2","rollup":"^2.75.0","react-dom":"^18.0.0","typescript":"^4.7.2","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","rollup-plugin-dts":"^4.2.2","rollup-plugin-terser":"^7.0.2","@rollup/plugin-commonjs":"^22.0.0","@rollup/plugin-typescript":"^8.3.2","@rollup/plugin-node-resolve":"^13.3.0","rollup-plugin-peer-deps-external":"^2.2.4"},"peerDependencies":{"react":">=16.8.0","react-dom":">=16.8.0"},"_npmOperationalInternal":{"tmp":"tmp/rating_1.0.1_1749123251173_0.02537760331728367","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@aniruddha1806/rating","version":"1.0.2","description":"A customizable rating component for React","main":"dist/cjs/index.js","module":"dist/esm/index.js","types":"dist/index.d.ts","scripts":{"build":"rollup -c","clean":"rimraf dist","prebuild":"npm run clean","prepublishOnly":"npm run build"},"keywords":["react","rating","component","stars","feedback"],"author":{"name":"Your Name"},"license":"MIT","peerDependencies":{"react":">=16.8.0","react-dom":">=16.8.0"},"devDependencies":{"@rollup/plugin-commonjs":"^22.0.0","@rollup/plugin-node-resolve":"^13.3.0","@rollup/plugin-typescript":"^8.3.2","@types/react":"^18.0.0","@types/react-dom":"^18.0.0","react":"^18.0.0","react-dom":"^18.0.0","rimraf":"^3.0.2","rollup":"^2.75.0","rollup-plugin-dts":"^4.2.2","rollup-plugin-peer-deps-external":"^2.2.4","rollup-plugin-terser":"^7.0.2","tslib":"^2.4.0","typescript":"^4.7.2"},"_id":"@aniruddha1806/rating@1.0.2","_nodeVersion":"20.14.0","_npmVersion":"10.9.1","dist":{"integrity":"sha512-Xrhiz+Gf4m9ePyBiKluYCQbV9ZyMhjbWHhgu5bKqIh29SxViTvnzntdHON1iKTQMdf/yheajwYY1kKT7bcx25Q==","shasum":"61bd0633a52fa9516342b70740123e8d9cff5fc8","tarball":"https://registry.npmjs.org/@aniruddha1806/rating/-/rating-1.0.2.tgz","fileCount":13,"unpackedSize":68670,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD1nFKkD9UqFpc3tENQyMqeWWfsN/0EiEwHlv0yeqtSLAIgN8BIdEoVBFTc+uS5m4Lfp8qlxQQaXYV8ttlQEBQmngg="}]},"_npmUser":{"name":"aniruddha1806","email":"aniruddha.kulkarni1806@gmail.com"},"directories":{},"maintainers":[{"name":"aniruddha1806","email":"aniruddha.kulkarni1806@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rating_1.0.2_1749123300838_0.68218184919037"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-04T14:27:27.649Z","modified":"2025-06-05T11:35:01.192Z","1.0.0":"2025-04-04T14:27:27.956Z","1.0.1":"2025-06-05T11:34:11.360Z","1.0.2":"2025-06-05T11:35:01.035Z"},"author":{"name":"Your Name"},"license":"MIT","keywords":["react","rating","component","stars","feedback"],"description":"A customizable rating component for React","maintainers":[{"name":"aniruddha1806","email":"aniruddha.kulkarni1806@gmail.com"}],"readme":"# React Rating Component\r\n\r\nA highly customizable, lightweight React rating component with TypeScript support. Perfect for star ratings, reviews, and feedback systems with zero dependencies.\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @aniruddha1806/rating\r\n\r\n```\r\n\r\n## Features\r\n\r\n- ⭐ Customizable star ratings\r\n- 🎨 Fully customizable colors, sizes, and icons\r\n- 🏷️ Support for rating labels and descriptions\r\n- 📱 Responsive design with flexible positioning\r\n- 🔒 Readonly mode for display-only ratings\r\n- 🎯 TypeScript support with full type definitions\r\n- 🪶 Zero dependencies and lightweight\r\n- ♿ Accessible and keyboard-friendly\r\n\r\n## Quick Start\r\n\r\n```jsx\r\nimport { Rating } from '@aniruddha1806/rating';\r\n\r\nfunction App() {\r\n  const handleRatingChange = (value) => {\r\n    console.log('Rating:', value);\r\n  };\r\n\r\n  return (\r\n    <Rating\r\n      initialValue={3}\r\n      onChange={handleRatingChange}\r\n    />\r\n  );\r\n}\r\n```\r\n\r\n## Props\r\n\r\n| Prop | Type | Default | Description |\r\n|------|------|---------|-------------|\r\n| `initialValue` | `number` | `0` | Initial rating value |\r\n| `maxValue` | `number` | `5` | Maximum number of stars |\r\n| `size` | `number` | `24` | Size of stars in pixels |\r\n| `readonly` | `boolean` | `false` | Make the rating read-only |\r\n| `activeColor` | `string` | `\"#FFD700\"` | Color of active/filled stars |\r\n| `inactiveColor` | `string` | `\"#E0E0E0\"` | Color of inactive/empty stars |\r\n| `hoverColor` | `string` | `\"#FFED85\"` | Color of stars on hover |\r\n| `emptyIcon` | `ReactNode` | `undefined` | Custom icon for empty stars |\r\n| `filledIcon` | `ReactNode` | `undefined` | Custom icon for filled stars |\r\n| `halfFilledIcon` | `ReactNode` | `undefined` | Custom icon for half-filled stars |\r\n| `onChange` | `(value: number) => void` | `undefined` | Callback when rating changes |\r\n| `className` | `string` | `\"\"` | Additional CSS class |\r\n| `style` | `CSSProperties` | `{}` | Inline styles for container |\r\n| `showValue` | `boolean` | `false` | Show numeric rating value |\r\n| `valuePosition` | `\"left\" \\\\| \"right\"` | `\"right\"` | Position of numeric value |\r\n| `label` | `string` | `\"\"` | Label text for the rating |\r\n| `labelPosition` | `\"top\" \\\\| \"bottom\" \\\\| \"left\" \\\\| \"right\"` | `\"top\"` | Position of label |\r\n| `gap` | `number` | `4` | Gap between elements in pixels |\r\n| `ratingLabels` | `string[]` | `[]` | Array of labels for each rating level |\r\n| `showRatingLabel` | `boolean` | `false` | Show descriptive rating label |\r\n| `ratingLabelPosition` | `\"top\" \\\\| \"bottom\"` | `\"bottom\"` | Position of rating label |\r\n| `ratingLabelStyle` | `CSSProperties` | `{}` | Styles for rating label |\r\n\r\n## Examples\r\n\r\n### Basic Rating\r\n\r\nSimple 5-star rating with default styling:\r\n\r\n```jsx\r\nimport { Rating } from '@aniruddha1806/rating';\r\n\r\nfunction BasicRating() {\r\n  return (\r\n    <Rating\r\n      initialValue={3}\r\n      onChange={(value) => console.log(value)}\r\n    />\r\n  );\r\n}\r\n```\r\n\r\n\r\n\r\n\r\n\r\n\r\n### Custom Colors and Size\r\n\r\nCustomize the appearance with different colors and sizes:\r\n\r\n```jsx\r\nimport { Rating } from '@aniruddha1806/rating';\r\n\r\nfunction CustomRating() {\r\n  return (\r\n    <Rating\r\n      initialValue={4}\r\n      size={32}\r\n      activeColor=\"#FF6B6B\"\r\n      inactiveColor=\"#DDD\"\r\n      hoverColor=\"#FF8E8E\"\r\n      onChange={(value) => console.log(value)}\r\n    />\r\n  );\r\n}\r\n```\r\n\r\n### With Rating Labels\r\n\r\nAdd descriptive labels for each rating level:\r\n\r\n```jsx\r\nimport { Rating } from '@aniruddha1806/rating';\r\n\r\nfunction LabeledRating() {\r\n  const ratingLabels = [\r\n    \"Terrible\",\r\n    \"Poor\", \r\n    \"Average\",\r\n    \"Good\",\r\n    \"Excellent\"\r\n  ];\r\n\r\n  return (\r\n    <Rating\r\n      initialValue={3}\r\n      ratingLabels={ratingLabels}\r\n      showRatingLabel={true}\r\n      ratingLabelPosition=\"bottom\"\r\n      onChange={(value) => console.log(value)}\r\n    />\r\n  );\r\n}\r\n```\r\n\r\n### Custom Icons\r\n\r\nUse custom icons instead of default stars:\r\n\r\n```jsx\r\nimport { Rating } from '@aniruddha1806/rating';\r\nimport { Heart, HeartOff } from 'lucide-react';\r\n\r\nfunction CustomIconRating() {\r\n  return (\r\n    <Rating\r\n      initialValue={3}\r\n      maxValue={5}\r\n      emptyIcon={<HeartOff size={24} />}\r\n      filledIcon={<Heart size={24} />}\r\n      activeColor=\"#E91E63\"\r\n      inactiveColor=\"#CCCCCC\"\r\n      onChange={(value) => console.log(value)}\r\n    />\r\n  );\r\n}\r\n```\r\n\r\n### Readonly Display\r\n\r\nShow ratings without allowing interaction:\r\n\r\n```jsx\r\nimport { Rating } from '@aniruddha1806/rating';\r\n\r\nfunction ReadonlyRating() {\r\n  return (\r\n    <Rating\r\n      initialValue={4.5}\r\n      \r\n      readonly={true}\r\n      showValue={true}\r\n      valuePosition=\"right\"\r\n    />\r\n  );\r\n}\r\n```\r\n\r\n### With Label and Value\r\n\r\nDisplay rating with label and numeric value:\r\n\r\n```jsx\r\nimport { Rating } from '@aniruddha1806/rating';\r\n\r\nfunction LabeledValueRating() {\r\n  return (\r\n    <Rating\r\n      initialValue={4}\r\n      label=\"Rate this product:\"\r\n      labelPosition=\"top\"\r\n      showValue={true}\r\n      valuePosition=\"right\"\r\n      onChange={(value) => console.log(value)}\r\n    />\r\n  );\r\n}\r\n```\r\n\r\n### Product Review Style\r\n\r\nComplete rating component for product reviews:\r\n\r\n```jsx\r\nimport { Rating } from '@aniruddha1806/rating';\r\n\r\nfunction ProductReview() {\r\n  const ratingLabels = [\r\n    \"Poor\",\r\n    \"Fair\", \r\n    \"Good\",\r\n    \"Very Good\",\r\n    \"Excellent\"\r\n  ];\r\n\r\n  return (\r\n    <div className=\"product-review\">\r\n      <Rating\r\n        initialValue={0}\r\n\r\n        size={28}\r\n        activeColor=\"#FFA500\"\r\n        hoverColor=\"#FFD700\"\r\n        label=\"Rate your experience:\"\r\n        labelPosition=\"top\"\r\n        showValue={true}\r\n        valuePosition=\"right\"\r\n        ratingLabels={ratingLabels}\r\n        showRatingLabel={true}\r\n        ratingLabelPosition=\"bottom\"\r\n        gap={6}\r\n        onChange={(value) => console.log('Review rating:', value)}\r\n        style={{ marginBottom: '20px' }}\r\n      />\r\n    </div>\r\n  );\r\n}\r\n```\r\n\r\n\r\n\r\n## TypeScript Usage\r\n\r\nThe component is fully typed and provides excellent TypeScript support:\r\n\r\n```typescript\r\nimport { Rating, RatingProps } from '@aniruddha1806/rating';\r\n\r\ninterface ReviewFormProps {\r\n  onSubmit: (rating: number) => void;\r\n}\r\n\r\nconst ReviewForm: React.FC<ReviewFormProps> = ({ onSubmit }) => {\r\n  const [rating, setRating] = useState<number>(0);\r\n\r\n  const handleRatingChange = (value: number): void => {\r\n    setRating(value);\r\n    onSubmit(value);\r\n  };\r\n\r\n  const ratingProps: RatingProps = {\r\n    initialValue: rating,\r\n    maxValue: 5,\r\n    onChange: handleRatingChange,\r\n    activeColor: \"#FFD700\",\r\n    size: 24\r\n  };\r\n\r\n  return <Rating {...ratingProps} />;\r\n};\r\n```\r\n\r\n## Styling\r\n\r\nThe component uses inline styles for maximum compatibility and doesn't require any CSS imports. You can customize the appearance using the provided props or by applying custom styles through the `className` and `style` props.\r\n\r\n\r\n","readmeFilename":"README.md"}