- 重构 Button、Card、Badge、Input、Textarea 等基础组件 - 新增 Accordion、Alert、Dialog、Dropdown、Form 等 shadcn/ui 组件 - 新增 AnimatedCounter、StatsShowcase、MetricCard 等数据展示组件 - 新增 ScrollReveal 滚动动画组件 - 重构 Toast 通知系统与 Tooltip 提示组件 - 更新设计令牌系统,对齐新品牌视觉
53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
'use client';
|
|
|
|
import * as React from 'react';
|
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
import { Circle } from 'lucide-react';
|
|
import { cn } from '@/lib/utils';
|
|
|
|
/**
|
|
* 标准 shadcn/ui RadioGroup 组件
|
|
* 基于 @radix-ui/react-radio-group
|
|
*/
|
|
const RadioGroup = React.forwardRef<
|
|
React.ElementRef<typeof RadioGroupPrimitive.Root>,
|
|
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
|
|
>(({ className, ...props }, ref) => (
|
|
<RadioGroupPrimitive.Root
|
|
ref={ref}
|
|
data-slot="radio-group"
|
|
className={cn('grid gap-2', className)}
|
|
{...props}
|
|
/>
|
|
));
|
|
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
|
|
const RadioGroupItem = React.forwardRef<
|
|
React.ElementRef<typeof RadioGroupPrimitive.Item>,
|
|
React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
|
|
>(({ className, ...props }, ref) => (
|
|
<RadioGroupPrimitive.Item
|
|
ref={ref}
|
|
data-slot="radio-group-item"
|
|
className={cn(
|
|
'aspect-square size-4 rounded-full border border-border-primary bg-bg-primary text-brand shadow-sm',
|
|
'focus:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2',
|
|
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
'data-[state=checked]:border-brand',
|
|
'transition-colors duration-fast',
|
|
className
|
|
)}
|
|
{...props}
|
|
>
|
|
<RadioGroupPrimitive.Indicator
|
|
data-slot="radio-group-indicator"
|
|
className="flex items-center justify-center"
|
|
>
|
|
<Circle className="size-2.5 fill-brand text-brand" />
|
|
</RadioGroupPrimitive.Indicator>
|
|
</RadioGroupPrimitive.Item>
|
|
));
|
|
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
|
|
export { RadioGroup, RadioGroupItem };
|