UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

54 lines (53 loc) 2.16 kB
"use client"; import { getThemeColor } from "../../../core/MantineProvider/color-functions/get-theme-color/get-theme-color.mjs"; import { getContrastColor } from "../../../core/MantineProvider/color-functions/get-contrast-color/get-contrast-color.mjs"; import { getAutoContrastValue } from "../../../core/MantineProvider/color-functions/get-auto-contrast-value/get-auto-contrast-value.mjs"; import { useMantineTheme } from "../../../core/MantineProvider/MantineThemeProvider/MantineThemeProvider.mjs"; import { useProps } from "../../../core/MantineProvider/use-props/use-props.mjs"; import { factory } from "../../../core/factory/factory.mjs"; import { Box } from "../../../core/Box/Box.mjs"; import { useProgressContext } from "../Progress.context.mjs"; import Progress_module_default from "../Progress.module.mjs"; import { jsx } from "react/jsx-runtime"; //#region packages/@mantine/core/src/components/Progress/ProgressSection/ProgressSection.tsx const defaultProps = { withAria: true }; const ProgressSection = factory((props) => { const { classNames, className, style, styles, vars, value, withAria, color, striped, animated, mod, ...others } = useProps("ProgressSection", defaultProps, props); const ctx = useProgressContext(); const theme = useMantineTheme(); const ariaAttributes = withAria ? { role: "progressbar", "aria-valuemax": 100, "aria-valuemin": 0, "aria-valuenow": value, "aria-valuetext": `${value}%` } : {}; return /* @__PURE__ */ jsx(Box, { ...ctx.getStyles("section", { className, classNames, styles, style }), ...others, ...ariaAttributes, mod: [{ striped: striped || animated, animated }, mod], __vars: { "--progress-section-size": `${value}%`, "--progress-section-color": getThemeColor(color, theme), "--progress-label-color": getAutoContrastValue(ctx.autoContrast, theme) ? getContrastColor({ color, theme, autoContrast: ctx.autoContrast }) : void 0 } }); }); ProgressSection.classes = Progress_module_default; ProgressSection.displayName = "@mantine/core/ProgressSection"; //#endregion export { ProgressSection }; //# sourceMappingURL=ProgressSection.mjs.map