commonux2
Version:
A collection of styled components for use in ABB projects, designed for React and Next.js. It features TypeScript support, integrates Lucide icons, and is built on Radix primitives with Tailwind CSS.
37 lines (36 loc) • 1.67 kB
JavaScript
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
import * as React from "react";
import * as ProgressPrimitive from "@radix-ui/react-progress";
import { cva } from "class-variance-authority";
import { cn } from "../../lib/utils";
export const progressVariants = cva("", {
variants: {
color: {
descructive: "bg-destructive",
primary: "bg-primary",
warn: "bg-orange-500",
secondary: "bg-secondary",
},
size: {
sm: "h-2",
md: "h-4",
},
},
});
const Progress = React.forwardRef((_a, ref) => {
var { className, value, color = "primary", size = "sm" } = _a, props = __rest(_a, ["className", "value", "color", "size"]);
return (React.createElement(ProgressPrimitive.Root, Object.assign({ ref: ref, className: cn("relative h-4 w-full overflow-hidden rounded-full bg-secondary", progressVariants({ size }), className) }, props),
React.createElement(ProgressPrimitive.Indicator, { className: cn("h-full w-full flex-1 transition-all", progressVariants({ color })), style: { transform: `translateX(-${100 - (value || 0)}%)` } })));
});
Progress.displayName = ProgressPrimitive.Root.displayName;
export { Progress };