diff --git a/src/components/ProgressBars/LinearProgressBar/LinearProgressBar.tsx b/src/components/ProgressBars/LinearProgressBar/LinearProgressBar.tsx index bb1f254e84..71d9c65dcd 100644 --- a/src/components/ProgressBars/LinearProgressBar/LinearProgressBar.tsx +++ b/src/components/ProgressBars/LinearProgressBar/LinearProgressBar.tsx @@ -4,7 +4,7 @@ import { SIZES } from "../../../constants"; import { getStyle } from "../../../helpers/typesciptCssModulesHelper"; import PercentageLabel from "../PercentageLabel/PercentageLabel"; import { ProgressBarStyle, ProgressBarType } from "./LinearProgressBarConstants"; -import { calculatePercentage, getProgressBarClassNames } from "./LinearProgressBarHelpers"; +import { calculatePercentage, getProgressBarClassNames, Size } from "./LinearProgressBarHelpers"; import Bar from "./Bar/Bar"; import { VibeComponent, VibeComponentProps, withStaticProps } from "../../../types"; import { ComponentDefaultTestId } from "../../../tests/constants"; @@ -43,7 +43,7 @@ interface LinearProgressBarProps extends VibeComponentProps { /** * Determine the progress bar height (Supported options exposed through `LinearProgressBar.sizes`) */ - size?: typeof SIZES; + size?: Size; /** * Show progress bar progression in percentages */ diff --git a/src/components/ProgressBars/LinearProgressBar/LinearProgressBarHelpers.ts b/src/components/ProgressBars/LinearProgressBar/LinearProgressBarHelpers.ts index 21848ca14e..18ed383fcf 100644 --- a/src/components/ProgressBars/LinearProgressBar/LinearProgressBarHelpers.ts +++ b/src/components/ProgressBars/LinearProgressBar/LinearProgressBarHelpers.ts @@ -1,7 +1,10 @@ import { toNumber } from "lodash-es"; +import { SIZES } from "./../../../constants/sizes"; import cx from "classnames"; import styles from "./LinearProgressBar.module.scss"; +export type Size = typeof SIZES[keyof typeof SIZES]; + export const calculatePercentage = (value: number, min: number, max: number) => { const valuePercentage = (toNumber(value - min) / toNumber(max - min)) * 100; return valuePercentage > 100 ? 100 : valuePercentage;