@cerberus-design/react
Version:
The Cerberus Design React component library.
30 lines (27 loc) • 773 B
JavaScript
'use client';
import { jsx } from 'react/jsx-runtime';
import { ProgressBarRoot, ProgressBarBar } from './primitives.js';
function ProgressBar(props) {
const { indeterminate, now, label, ...nativeProps } = props;
const nowClamped = Math.min(100, Math.max(0, now || 0));
const width = {
width: indeterminate ? "50%" : `${nowClamped}%`
};
return /* @__PURE__ */ jsx(
ProgressBarRoot,
{
...nativeProps,
"aria-label": label,
"aria-valuenow": indeterminate ? 0 : nowClamped,
children: /* @__PURE__ */ jsx(
ProgressBarBar,
{
...indeterminate && { "data-state": "indeterminate" },
"data-complete": nowClamped === 100,
style: width
}
)
}
);
}
export { ProgressBar };