| { | |
| "type": "composition", | |
| "npmDependencies": [], | |
| "fileDependencies": [], | |
| "id": "radio-card", | |
| "file": { | |
| "name": "radio-card.tsx", | |
| "content": "import { RadioCard } from \"@chakra-ui/react\"\nimport * as React from \"react\"\n\ninterface RadioCardItemProps extends RadioCard.ItemProps {\n icon?: React.ReactElement\n label?: React.ReactNode\n description?: React.ReactNode\n addon?: React.ReactNode\n indicator?: React.ReactNode | null\n indicatorPlacement?: \"start\" | \"end\" | \"inside\"\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>\n}\n\nexport const RadioCardItem = React.forwardRef<\n HTMLInputElement,\n RadioCardItemProps\n>(function RadioCardItem(props, ref) {\n const {\n inputProps,\n label,\n description,\n addon,\n icon,\n indicator = <RadioCard.ItemIndicator />,\n indicatorPlacement = \"end\",\n ...rest\n } = props\n\n const hasContent = label || description || icon\n const ContentWrapper = indicator ? RadioCard.ItemContent : React.Fragment\n\n return (\n <RadioCard.Item {...rest}>\n <RadioCard.ItemHiddenInput ref={ref} {...inputProps} />\n <RadioCard.ItemControl>\n {indicatorPlacement === \"start\" && indicator}\n {hasContent && (\n <ContentWrapper>\n {icon}\n {label && <RadioCard.ItemText>{label}</RadioCard.ItemText>}\n {description && (\n <RadioCard.ItemDescription>\n {description}\n </RadioCard.ItemDescription>\n )}\n {indicatorPlacement === \"inside\" && indicator}\n </ContentWrapper>\n )}\n {indicatorPlacement === \"end\" && indicator}\n </RadioCard.ItemControl>\n {addon && <RadioCard.ItemAddon>{addon}</RadioCard.ItemAddon>}\n </RadioCard.Item>\n )\n})\n\nexport const RadioCardRoot = RadioCard.Root\nexport const RadioCardLabel = RadioCard.Label\nexport const RadioCardItemIndicator = RadioCard.ItemIndicator\n" | |
| }, | |
| "component": "RadioCard" | |
| } |