@progress/kendo-react-progressbars
Version:
React ProgressBars offer a customizable interface for users to track and display the progress of a task. KendoReact ProgressBars package
25 lines (24 loc) • 1.11 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import { LABEL_DECIMALS as a, MIN_RATIO as o } from "./constants.mjs";
const h = (e) => {
const t = e.toString().split(".");
return t.length === 1 ? `${t[0]}` : `${t[0]}.${t[1].substr(0, a)}`;
}, l = (e, t, n) => {
const r = Math.abs((t - e) / 100);
return Math.abs((n - e) / r);
}, $ = (e, t, n, r) => {
const c = Math.max(n, 0.01), u = 100 / c * 100;
e.current && t.current && (e.current.style.width = r ? "100%" : `${c}%`, t.current.style.width = r ? "100%" : `${u}%`, e.current.style.height = r ? `${c}%` : "100%", t.current.style.height = r ? `${u}%` : "100%");
}, g = (e, t, n) => Math.max((n - e) / (t - e), o);
export {
l as calculatePercentage,
g as calculateRatio,
h as truncateNumber,
$ as updateProgress
};