@yandex/ui
Version:
Yandex UI components
17 lines (16 loc) • 1.03 kB
JavaScript
import { __assign, __rest } from "tslib";
import React from 'react';
import { cn } from '@bem-react/classname';
import './Progress.css';
export var cnProgress = cn('Progress');
/**
* Компонент для создания полосы прогресса.
* @param {IProgressProps} props
*/
export var Progress = function (_a) {
var _b = _a.value, value = _b === void 0 ? 0 : _b, _c = _a.maxValue, maxValue = _c === void 0 ? 1 : _c, timing = _a.timing, innerRef = _a.innerRef, style = _a.style, className = _a.className, props = __rest(_a, ["value", "maxValue", "timing", "innerRef", "style", "className"]);
var width = value <= 0 ? 0 : (value >= maxValue ? 100 : ((100 / maxValue) * value).toFixed(2)) + "%";
return (React.createElement("div", __assign({}, props, { ref: innerRef, className: cnProgress({ timing: timing }, [className]), style: __assign({}, style) }),
React.createElement("div", { className: cnProgress('Inner'), style: { width: width } })));
};
Progress.displayName = cnProgress();