UNPKG

@cerberus-design/react

Version:

The Cerberus Design React component library.

34 lines (29 loc) 906 B
'use client'; 'use strict'; Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); const jsxRuntime = require('react/jsx-runtime'); const primitives = require('./primitives.cjs'); 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__ */ jsxRuntime.jsx( primitives.ProgressBarRoot, { ...nativeProps, "aria-label": label, "aria-valuenow": indeterminate ? 0 : nowClamped, children: /* @__PURE__ */ jsxRuntime.jsx( primitives.ProgressBarBar, { ...indeterminate && { "data-state": "indeterminate" }, "data-complete": nowClamped === 100, style: width } ) } ); } exports.ProgressBar = ProgressBar;