mirror of
https://github.com/cosscom/coss.git
synced 2026-09-14 20:06:50 +08:00
14 lines
1.9 KiB
JSON
14 lines
1.9 KiB
JSON
{
|
|
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
|
|
"name": "meter",
|
|
"type": "registry:ui",
|
|
"dependencies": ["@base-ui-components/react"],
|
|
"files": [
|
|
{
|
|
"path": "registry/default/ui/meter.tsx",
|
|
"content": "\"use client\"\n\nimport { Meter as MeterPrimitive } from \"@base-ui-components/react/meter\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Meter({ className, children, ...props }: MeterPrimitive.Root.Props) {\n return (\n <MeterPrimitive.Root\n className={cn(\"flex w-full flex-col gap-2\", className)}\n {...props}\n >\n {children ? (\n children\n ) : (\n <MeterTrack>\n <MeterIndicator />\n </MeterTrack>\n )}\n </MeterPrimitive.Root>\n )\n}\n\nfunction MeterLabel({ className, ...props }: MeterPrimitive.Label.Props) {\n return (\n <MeterPrimitive.Label\n data-slot=\"meter-label\"\n className={cn(\"text-sm font-medium\", className)}\n {...props}\n />\n )\n}\n\nfunction MeterTrack({ className, ...props }: MeterPrimitive.Track.Props) {\n return (\n <MeterPrimitive.Track\n data-slot=\"meter-track\"\n className={cn(\"block h-2 w-full overflow-hidden bg-input\", className)}\n {...props}\n />\n )\n}\n\nfunction MeterIndicator({\n className,\n ...props\n}: MeterPrimitive.Indicator.Props) {\n return (\n <MeterPrimitive.Indicator\n data-slot=\"meter-indicator\"\n className={cn(\"bg-primary transition-all duration-500\", className)}\n {...props}\n />\n )\n}\n\nfunction MeterValue({ className, ...props }: MeterPrimitive.Value.Props) {\n return (\n <MeterPrimitive.Value\n data-slot=\"meter-value\"\n className={cn(\"text-sm tabular-nums\", className)}\n {...props}\n />\n )\n}\n\nexport { Meter, MeterLabel, MeterTrack, MeterIndicator, MeterValue }\n",
|
|
"type": "registry:ui"
|
|
}
|
|
]
|
|
}
|