@gravity-ui/uikit
Version:
Gravity UI base styling and components
27 lines (26 loc) • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProgressWithValue = ProgressWithValue;
const jsx_runtime_1 = require("react/jsx-runtime");
const ProgressInnerText_1 = require("./ProgressInnerText.js");
const constants_1 = require("./constants.js");
const utils_1 = require("./utils.js");
function ProgressWithValue(props) {
const { value, loading, text } = props;
const offset = (0, utils_1.getOffset)(value);
const { theme, color } = (0, utils_1.getTheme)(props);
const modifiers = {
loading,
};
if (typeof color === 'undefined') {
modifiers.theme = theme || 'default';
}
if (Number.isFinite(value)) {
return ((0, jsx_runtime_1.jsx)("div", { className: (0, constants_1.progressBlock)('item', modifiers), style: {
transform: `translateX(calc(var(--g-flow-direction) * ${offset}%))`,
backgroundColor: color,
}, children: (0, jsx_runtime_1.jsx)(ProgressInnerText_1.ProgressInnerText, { offset: offset, text: text }) }));
}
return null;
}
//# sourceMappingURL=ProgressWithValue.js.map