@gravity-ui/uikit
Version:
Gravity UI base styling and components
24 lines (23 loc) • 917 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { ProgressInnerText } from "./ProgressInnerText.js";
import { progressBlock } from "./constants.js";
import { getOffset, getTheme } from "./utils.js";
export function ProgressWithValue(props) {
const { value, loading, text } = props;
const offset = getOffset(value);
const { theme, color } = getTheme(props);
const modifiers = {
loading,
};
if (typeof color === 'undefined') {
modifiers.theme = theme || 'default';
}
if (Number.isFinite(value)) {
return (_jsx("div", { className: progressBlock('item', modifiers), style: {
transform: `translateX(calc(var(--g-flow-direction) * ${offset}%))`,
backgroundColor: color,
}, children: _jsx(ProgressInnerText, { offset: offset, text: text }) }));
}
return null;
}
//# sourceMappingURL=ProgressWithValue.js.map