FactuGES_ERP/packages/shadcn-ui/src/components/progress.tsx

84 lines
1.7 KiB
TypeScript
Raw Normal View History

2026-04-12 10:07:54 +00:00
"use client"
import { Progress as ProgressPrimitive } from "@base-ui/react/progress"
2025-05-05 17:11:44 +00:00
import { cn } from "@repo/shadcn-ui/lib/utils"
function Progress({
className,
2026-04-12 10:07:54 +00:00
children,
2025-05-05 17:11:44 +00:00
value,
...props
2026-04-12 10:07:54 +00:00
}: ProgressPrimitive.Root.Props) {
2025-05-05 17:11:44 +00:00
return (
<ProgressPrimitive.Root
2026-04-12 10:07:54 +00:00
value={value}
2025-05-05 17:11:44 +00:00
data-slot="progress"
2026-04-12 10:07:54 +00:00
className={cn("flex flex-wrap gap-3", className)}
{...props}
>
{children}
<ProgressTrack>
<ProgressIndicator />
</ProgressTrack>
</ProgressPrimitive.Root>
)
}
function ProgressTrack({ className, ...props }: ProgressPrimitive.Track.Props) {
return (
<ProgressPrimitive.Track
2025-05-05 17:11:44 +00:00
className={cn(
2026-04-12 10:07:54 +00:00
"relative flex h-1.5 w-full items-center overflow-x-hidden rounded-full bg-muted",
2025-05-05 17:11:44 +00:00
className
)}
2026-04-12 10:07:54 +00:00
data-slot="progress-track"
2025-05-05 17:11:44 +00:00
{...props}
2026-04-12 10:07:54 +00:00
/>
2025-05-05 17:11:44 +00:00
)
}
2026-04-12 10:07:54 +00:00
function ProgressIndicator({
className,
...props
}: ProgressPrimitive.Indicator.Props) {
return (
<ProgressPrimitive.Indicator
data-slot="progress-indicator"
className={cn("h-full bg-primary transition-all", className)}
{...props}
/>
)
}
function ProgressLabel({ className, ...props }: ProgressPrimitive.Label.Props) {
return (
<ProgressPrimitive.Label
className={cn("text-sm font-medium", className)}
data-slot="progress-label"
{...props}
/>
)
}
function ProgressValue({ className, ...props }: ProgressPrimitive.Value.Props) {
return (
<ProgressPrimitive.Value
className={cn(
"ml-auto text-sm text-muted-foreground tabular-nums",
className
)}
data-slot="progress-value"
{...props}
/>
)
}
export {
Progress,
ProgressTrack,
ProgressIndicator,
ProgressLabel,
ProgressValue,
}