| { | |
| "type": "composition", | |
| "npmDependencies": [], | |
| "fileDependencies": [], | |
| "id": "rating", | |
| "file": { | |
| "name": "rating.tsx", | |
| "content": "import { RatingGroup } from \"@chakra-ui/react\"\nimport * as React from \"react\"\n\nexport interface RatingProps extends RatingGroup.RootProps {\n icon?: React.ReactElement\n count?: number\n label?: React.ReactNode\n}\n\nexport const Rating = React.forwardRef<HTMLDivElement, RatingProps>(\n function Rating(props, ref) {\n const { icon, count = 5, label, ...rest } = props\n return (\n <RatingGroup.Root ref={ref} count={count} {...rest}>\n {label && <RatingGroup.Label>{label}</RatingGroup.Label>}\n <RatingGroup.HiddenInput />\n <RatingGroup.Control>\n {Array.from({ length: count }).map((_, index) => (\n <RatingGroup.Item key={index} index={index + 1}>\n <RatingGroup.ItemIndicator icon={icon} />\n </RatingGroup.Item>\n ))}\n </RatingGroup.Control>\n </RatingGroup.Root>\n )\n },\n)\n" | |
| }, | |
| "component": "Rating" | |
| } |